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
Push — master ( 94e26e...7859c5 )
by Fábio Tadeu da
48s queued 12s
created

OutboxMappedSuperclass::fromOutboxEntry()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 22
ccs 15
cts 15
cp 1
rs 9.7998
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Dsantang\DomainEventsDoctrine\Outbox;
6
7
use DateTimeImmutable;
8
use Doctrine\ORM\Mapping as ORM;
9
use Doctrine\ORM\Mapping\MappedSuperclass;
10
use Ramsey\Uuid\Uuid;
11
use Ramsey\Uuid\UuidInterface;
12
13
/**
14
 * @MappedSuperclass
15
 */
16
abstract class OutboxMappedSuperclass
17
{
18
    /**
19
     * @ORM\Id
20
     * @ORM\Column(type="uuid")
21
     *
22
     * @var UuidInterface
23
     */
24
    protected $id;
25
26
    /**
27
     * @ORM\Column(type="string")
28
     *
29
     * @var string
30
     */
31
    protected $messageKey;
32
33
    /**
34
     * @ORM\Column(type="string")
35
     *
36
     * @var string
37
     */
38
    protected $messageRoute;
39
40
    /**
41
     * @ORM\Column(type="string")
42
     *
43
     * @var string
44
     */
45
    protected $messageType;
46
47
    /**
48
     * @ORM\Column(type="uuid")
49
     *
50
     * @var UuidInterface
51
     */
52
    protected $aggregateId;
53
54
    /**
55
     * @ORM\Column(type="string")
56
     *
57
     * @var string
58
     */
59
    protected $aggregateType;
60
61
    /**
62
     * @ORM\Column(type="string")
63
     *
64
     * @var string
65
     */
66
    protected $payloadType;
67
68
    /**
69
     * @ORM\Column(type="json_array", options={"jsonb"=true})
70
     *
71
     * @var mixed[]
72
     */
73
    protected $payload;
74
75
    /**
76
     * @ORM\Column(type="integer")
77
     *
78
     * @var int
79
     */
80
    protected $schemaVersion;
81
82
    /**
83
     * @ORM\Column(type="utc_datetime_immutable")
84
     *
85
     * @var DateTimeImmutable
86
     */
87
    protected $createdAt;
88
89
    /**
90
     * @ORM\Column(type="uuid", nullable=true)
91
     * @ORM\OneToOne(targetEntity=OutboxMappedSuperclass::class)
92
     *
93
     * @var UuidInterface|null
94
     */
95
    protected $previousEvent;
96
97 3
    public function fromOutboxEntry(
98
        OutboxEntry $outboxEntry,
99
        ?OutboxMappedSuperclass $previousEntity = null
100
    ) : OutboxMappedSuperclass {
101 3
        $outbox = clone $this;
102
103 3
        $outbox->id            = Uuid::uuid4();
104 3
        $outbox->messageKey    = $outboxEntry->getMessageKey();
105 3
        $outbox->messageRoute  = $outboxEntry->getMessageRoute();
106 3
        $outbox->messageType   = $outboxEntry->getMessageType();
107 3
        $outbox->aggregateId   = $outboxEntry->getAggregateId();
108 3
        $outbox->aggregateType = $outboxEntry->getAggregateType();
109 3
        $outbox->payloadType   = $outboxEntry->getPayloadType();
110 3
        $outbox->payload       = $outboxEntry->getPayload();
111 3
        $outbox->schemaVersion = $outboxEntry->getSchemaVersion();
112 3
        $outbox->createdAt     = new DateTimeImmutable();
113
114 3
        if ($previousEntity instanceof OutboxMappedSuperclass) {
115 2
            $outbox->previousEvent = $previousEntity->getId();
116
        }
117
118 3
        return $outbox;
119
    }
120
121 2
    private function getId() : UuidInterface
122
    {
123 2
        return $this->id;
124
    }
125
}
126