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 (#7)
by Fábio Tadeu da
01:50
created

OutboxMappedSuperclass   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 23
dl 0
loc 91
rs 10
c 0
b 0
f 0
ccs 13
cts 13
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A withOutboxEntry() 0 16 1
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
     * @var \Ramsey\Uuid\UuidInterface
20
     *
21
     * @ORM\Id
22
     * @ORM\Column(type="uuid", unique=true)
23
     * @ORM\GeneratedValue(strategy="CUSTOM")
24
     * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator")
25
     */
26
    protected $id;
27
28
    /**
29
     * @ORM\Column(type="string")
30
     *
31
     * @var string
32
     */
33
    protected $messageKey;
34
35
    /**
36
     * @ORM\Column(type="string")
37
     *
38
     * @var string
39
     */
40
    protected $messageRoute;
41
42
    /**
43
     * @ORM\Column(type="string")
44
     *
45
     * @var string
46
     */
47
    protected $messageType;
48
49
    /**
50
     * @ORM\Column(type="uuid")
51
     *
52
     * @var UuidInterface
53
     */
54
    protected $aggregateId;
55
56
    /**
57
     * @ORM\Column(type="string")
58
     *
59
     * @var string
60
     */
61
    protected $aggregateType;
62
63
    /**
64
     * @ORM\Column(type="string")
65
     *
66
     * @var string
67
     */
68
    protected $payloadType;
69
70
    /**
71
     * @ORM\Column(type="json")
72
     *
73
     * @var string
74
     */
75
    protected $payload;
76
77
    /**
78
     * @ORM\Column(type="integer")
79
     *
80
     * @var int
81
     */
82
    protected $schemaVersion;
83
84
    /**
85
     * @ORM\Column(type="utc_datetime_immutable")
86
     *
87
     * @var DateTimeImmutable
88
     */
89
    protected $createdAt;
90
91 1
    public function withOutboxEntry(OutboxEntry $outboxEntry) : OutboxMappedSuperclass
92
    {
93 1
        $outbox = clone $this;
94
95 1
        $outbox->id            = Uuid::uuid4();
96 1
        $outbox->messageKey    = $outboxEntry->getMessageKey();
97 1
        $outbox->messageRoute  = $outboxEntry->getMessageRoute();
98 1
        $outbox->messageType   = $outboxEntry->getMessageType();
99 1
        $outbox->aggregateId   = $outboxEntry->getAggregateId();
100 1
        $outbox->aggregateType = $outboxEntry->getAggregateType();
101 1
        $outbox->payloadType   = $outboxEntry->getPayloadType();
102 1
        $outbox->payload       = $outboxEntry->getPayload();
103 1
        $outbox->schemaVersion = $outboxEntry->getSchemaVersion();
104 1
        $outbox->createdAt     = new DateTimeImmutable();
105
106 1
        return $outbox;
107
    }
108
}
109