AuditEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace DH\DoctrineAuditBundle\Event;
4
5
use Symfony\Component\EventDispatcher\Event as ComponentEvent;
6
use Symfony\Contracts\EventDispatcher\Event as ContractsEvent;
7
8
if (class_exists(ContractsEvent::class)) {
9
    abstract class AuditEvent extends ContractsEvent
10
    {
11
        /**
12
         * @var array
13
         */
14
        private $payload;
15
16
        public function __construct(array $payload)
17
        {
18
            $this->payload = $payload;
19
        }
20
21
        /**
22
         * @return array
23
         */
24
        final public function getPayload(): array
25
        {
26
            return $this->payload;
27
        }
28
    }
29
} else {
30
    abstract class AuditEvent extends ComponentEvent
31
    {
32
        /**
33
         * @var array
34
         */
35
        private $payload;
36
37
        public function __construct(array $payload)
38
        {
39
            $this->payload = $payload;
40
        }
41
42
        /**
43
         * @return array
44
         */
45
        final public function getPayload(): array
46
        {
47
            return $this->payload;
48
        }
49
    }
50
}
51