• 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/Controller.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 Daycry\Auth\Models\EndpointModel;
17

18
class Controller extends Entity
19
{
20
    /**
21
     * @var list<Endpoint>|null
22
     */
23
    private ?array $endpoints = null;
24

25
    /**
26
     * @var         list<string>
27
     * @phpstan-var list<string>
28
     * @psalm-var list<string>
29
     */
30
    protected $dates = [
31
        'created_at',
32
        'updated_at',
33
        'deleted_at',
34
        'checked_at',
35
    ];
36

37
    /**
38
     * @var array<string, string>
39
     */
40
    protected $casts = [
41
        'id'  => '?integer',
42
        'url' => 'string',
43
    ];
44

45
    /**
46
     * Accessor method for this controller's Endpoint objects.
47
     * Will populate if they don't exist.
48
     *
49
     * @param string $endpoint 'all' returns all endpoints.
50
     *
51
     * @return list<Endpoint>
52
     */
UNCOV
53
    public function getEndpoints(string $endpoint = 'all'): ?array
×
54
    {
55
        $this->populateEndpoints();
×
56

57
        if ($endpoint === 'all') {
×
58
            return $this->endpoints;
×
59
        }
60

61
        $endpoints = [];
×
62

63
        foreach ($this->endpoints as $e) {
×
64
            if ($e->method === $endpoint) {
×
65
                $endpoints[] = $e;
×
66
            }
67
        }
68

69
        return $endpoints;
×
70
    }
71

72
    /**
73
     * ensures that all of the controllers's endpoints are loaded
74
     * into the instance for faster access later.
75
     */
UNCOV
76
    private function populateEndpoints(): void
×
77
    {
78
        if ($this->endpoints === null) {
×
79
            /** @var EndpointModel $endpointModel */
80
            $endpointModel = model(EndpointModel::class);
×
81

82
            $this->endpoints = $endpointModel->getEndpoints($this);
×
83
        }
84
    }
85
}
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