• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daycry / auth / 22527658769

28 Feb 2026 07:41PM UTC coverage: 63.267% (-3.6%) from 66.864%
22527658769

push

github

web-flow
Merge pull request #36 from daycry/development

Implement TOTP 2FA, JWT auth, device session tracking, and docs overhaul

465 of 1168 new or added lines in 52 files covered. (39.81%)

129 existing lines in 46 files now uncovered.

3064 of 4843 relevant lines covered (63.27%)

41.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Entities/AccessToken.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of Daycry Auth.
7
 *
8
 * (c) Daycry <daycry9@proton.me>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace Daycry\Auth\Entities;
15

16
use CodeIgniter\I18n\Time;
17

18
/**
19
 * Class AccessToken
20
 *
21
 * Represents a single Personal Access Token, used
22
 * for authenticating users for an API.
23
 *
24
 * @property string|Time|null $last_used_at
25
 */
26
class AccessToken extends UserIdentity
27
{
28
    /**
29
     * @var array<string, string>
30
     */
31
    protected $casts = [
32
        'extra' => 'serialized',
33
    ];
34

35
    /**
36
     * @var array<string, string>
37
     */
38
    protected $datamap = [
39
        'scopes' => 'extra',
40
    ];
41

42
    /**
43
     * Determines whether this token grants
44
     * permission to the $scope
45
     */
UNCOV
46
    public function can(string $scope): bool
×
47
    {
48
        if ($this->extra === []) {
×
49
            return false;
×
50
        }
51

52
        // Wildcard present
53
        if (in_array('*', $this->extra, true)) {
×
54
            return true;
×
55
        }
56

57
        // Check stored scopes
58
        return in_array($scope, $this->extra, true);
×
59
    }
60

61
    /**
62
     * Determines whether this token does NOT
63
     * grant permission to $scope.
64
     */
UNCOV
65
    public function cant(string $scope): bool
×
66
    {
67
        return ! $this->can($scope);
×
68
    }
69
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc