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.
Test Failed
Pull Request — master (#7)
by Fábio Tadeu da
01:42
created

StubMapBased::onFlush()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Dsantang\DomainEventsDoctrine\Tests\Unit\Outbox\Stub;
6
7
use Doctrine\ORM\EntityManagerInterface;
8
use Doctrine\ORM\Event\OnFlushEventArgs;
9
use Dsantang\DomainEvents\DomainEvent;
10
use Dsantang\DomainEventsDoctrine\Outbox\EventsHandler;
11
use Dsantang\DomainEventsDoctrine\Outbox\OutboxEntry;
12
use Dsantang\DomainEventsDoctrine\Outbox\OutboxMappedSuperclass;
13
14
final class StubMapBased extends EventsHandler
15
{
16
    /** @var OutboxMappedSuperclass */
17
    private $outboxMappedSuperclass;
18
19
    /** @var array */
20
    private $conversionMap;
21
22
    /**
23
     * @param array $conversionMap
24
     */
25
    public function __construct(OutboxMappedSuperclass $outboxMappedSuperclass, array $conversionMap)
26
    {
27
        $this->outboxMappedSuperclass = $outboxMappedSuperclass;
28
        $this->conversionMap          = $conversionMap;
29
    }
30
31
    public function getDomainsEvents(OnFlushEventArgs $eventArgs) : array
32
    {
33
        return parent::getDomainsEvents($eventArgs);
34
    }
35
36
    public function convert(array $conversionMap, DomainEvent ...$domainEvents) : array
37
    {
38
        return parent::convert($conversionMap, ...$domainEvents);
39
    }
40
41
    public function persist(EntityManagerInterface $entityManager, OutboxMappedSuperclass $outboxMappedSuperclass, OutboxEntry ...$outboxEntries) : void
42
    {
43
        parent::persist($entityManager, $outboxMappedSuperclass, ...$outboxEntries);
44
    }
45
46
    public function onFlush(OnFlushEventArgs $eventArgs) : void
47
    {
48
        $domainEvents = $this->getDomainsEvents($eventArgs);
49
50
        $outboxEvents = $this->convert($this->conversionMap, ...$domainEvents);
51
52
        if (empty($outboxEvents)) {
53
            return;
54
        }
55
56
        $this->persist($eventArgs->getEntityManager(), $this->outboxMappedSuperclass, ...$outboxEvents);
57
    }
58
}
59