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.

TrackingId::sameValueAs()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/*
3
 * This file is part of the prooph/php-ddd-cargo-sample package.
4
 * (c) Alexander Miertsch <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
declare(strict_types = 1);
10
11
namespace Codeliner\CargoBackend\Model\Cargo;
12
13
use Ramsey\Uuid\Uuid;
14
use Ramsey\Uuid\UuidInterface;
15
16
/**
17
 * TrackingId is the unique identifier of a Cargo
18
 * 
19
 * @author Alexander Miertsch <[email protected]>
20
 */
21
class TrackingId
22
{
23
    /**
24
     * @param string $aTrackingId
25
     * @return TrackingId
26
     */
27
    public static function fromString(string $aTrackingId): TrackingId
28
    {
29
        return new self(Uuid::fromString($aTrackingId));
30
    }
31
32
    /**
33
     * @return TrackingId
34
     */
35
    public static function generate(): TrackingId
36
    {
37
        return new self(Uuid::uuid4());
38
    }
39
40
    /**
41
     * @var Uuid
42
     */
43
    private $uuid;
44
45
    /**
46
     * Always provide a string representation of the TrackingId to construct the VO
47
     * 
48
     * @param UuidInterface $aUuid
49
     * 
50
     * @throws Exception\InvalidArgumentException
51
     */
52
    public function __construct(UuidInterface $aUuid)
53
    {
54
        $this->uuid = $aUuid;
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function toString(): string
61
    {
62
        return $this->uuid->toString();
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function __toString(): string
69
    {
70
        return $this->toString();
71
    }
72
73
    /**
74
     * @param TrackingId $other
75
     * @return bool
76
     */
77
    public function sameValueAs(TrackingId $other): bool
78
    {
79
        return $this->toString() === $other->toString();
80
    }
81
}
82