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

FastyBird / simple-auth / 9954252110

16 Jul 2024 09:26AM UTC coverage: 66.994% (+1.3%) from 65.685%
9954252110

push

github

web-flow
Integrate Casbin authorizator (#6)

114 of 161 new or added lines in 9 files covered. (70.81%)

2 existing lines in 2 files now uncovered.

477 of 712 relevant lines covered (66.99%)

4.59 hits per line

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

60.0
/src/Security/PlainIdentity.php
1
<?php declare(strict_types = 1);
2

3
/**
4
 * PlainIdentity.php
5
 *
6
 * @license        More in LICENSE.md
7
 * @copyright      https://www.fastybird.com
8
 * @author         Adam Kadlec <adam.kadlec@fastybird.com>
9
 * @package        FastyBird:SimpleAuth!
10
 * @subpackage     Security
11
 * @since          0.1.0
12
 *
13
 * @date           15.07.20
14
 */
15

16
namespace FastyBird\SimpleAuth\Security;
17

18
use FastyBird\SimpleAuth\Exceptions;
19
use FastyBird\SimpleAuth\Security;
20
use Nette;
21
use Ramsey\Uuid;
22

23
/**
24
 * System basic plain identity
25
 *
26
 * @package        FastyBird:SimpleAuth!
27
 * @subpackage     Security
28
 *
29
 * @author         Adam Kadlec <adam.kadlec@fastybird.com>
30
 */
31
class PlainIdentity implements Security\IIdentity
32
{
33

34
        use Nette\SmartObject;
35

36
        private Uuid\UuidInterface $id;
37

38
        /**
39
         * @param array<string> $roles
40
         *
41
         * @throws Exceptions\InvalidArgument
42
         */
43
        public function __construct(string $id, private readonly array $roles = [])
44
        {
45
                if (!Uuid\Uuid::isValid($id)) {
9✔
46
                        throw new Exceptions\InvalidArgument('User identifier have to be valid UUID string');
×
47
                }
48

49
                $this->id = Uuid\Uuid::fromString($id);
9✔
50
        }
51

52
        public function getId(): Uuid\UuidInterface
53
        {
54
                return $this->id;
6✔
55
        }
56

57
        /**
58
         * @return array<string>
59
         */
60
        public function getRoles(): array
61
        {
UNCOV
62
                return $this->roles;
×
63
        }
64

65
}
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