Passed
Pull Request — master (#3)
by Alex
03:31
created

AbstractEntityEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 10
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\DoctrineEntityRepository\Persistence\Event;
6
7
use Arp\EventDispatcher\Event\NamedEvent;
8
use Doctrine\ORM\EntityManagerInterface;
9
10
/**
11
 * @author  Alex Patterson <[email protected]>
12
 * @package Arp\DoctrineEntityRepository\Persistence\Event
13
 */
14
abstract class AbstractEntityEvent extends NamedEvent
15
{
16
    /**
17
     * @var string
18
     */
19
    private $entityName;
20
21
    /**
22
     * @var EntityManagerInterface
23
     */
24
    private $entityManager;
25
26
    /**
27
     * @param string                 $eventName
28
     * @param string                 $entityName
29
     * @param EntityManagerInterface $entityManager
30
     * @param array                  $params
31
     */
32
    public function __construct(
33
        string $eventName,
34
        string $entityName,
35
        EntityManagerInterface $entityManager,
36
        array $params = []
37
    ) {
38
        parent::__construct($eventName, $params);
39
40
        $this->entityName = $entityName;
41
        $this->entityManager = $entityManager;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getEntityName(): string
48
    {
49
        return $this->entityName;
50
    }
51
52
    /**
53
     * @return EntityManagerInterface
54
     */
55
    public function getEntityManager(): EntityManagerInterface
56
    {
57
        return $this->entityManager;
58
    }
59
}
60