GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#152)
by joseph
15:36
created

AbstractUuidFieldTrait::getUuid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\PrimaryKey;
4
5
use EdmondsCommerce\DoctrineStaticMeta\Entity\Debug\DebugEntityDataObjectIds;
6
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Factories\UuidFactory;
7
use Ramsey\Uuid\UuidInterface;
8
9
trait AbstractUuidFieldTrait
10
{
11
    /**
12
     * @var UuidInterface
13
     */
14
    private $id;
15
16
    use DebugEntityDataObjectIds;
17
18
    abstract public static function buildUuid(UuidFactory $uuidFactory): UuidInterface;
19
20
    /**
21
     * This is leveraging the setter injection that happens on Entity creation to ensure that the UUID is set
22
     *
23
     * @param UuidFactory $uuidFactory
24
     */
25
    public function injectUuid(UuidFactory $uuidFactory)
26
    {
27
        if (null === $this->id) {
28
            $this->setId(self::buildUuid($uuidFactory));
29
        }
30
    }
31
32
    public function getId(): UuidInterface
33
    {
34
        return $this->id;
35
    }
36
37
    public function getUuid(): UuidInterface
38
    {
39
        return $this->id;
40
    }
41
42
    private function setId(UuidInterface $uuid): self
43
    {
44
        if (null !== $this->id) {
45
            throw new \InvalidArgumentException('Trying to update ID when it has already been set');
46
        }
47
        $this->id = $uuid;
48
        $this->initDebugIds(true);
49
50
        return $this;
51
    }
52
}
53