AbstractExecuteEventSubscriber   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 41
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPrototypeEvent() 0 8 2
A setPrototypeEvent() 0 6 1
1
<?php
2
/**
3
 * @link    https://github.com/nnx-framework/doctrine-fixture-module
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\DoctrineFixtureModule\Listener;
7
8
use Doctrine\Common\EventSubscriber;
9
use Nnx\DoctrineFixtureModule\Event\FixtureExecutorEvent;
10
use Nnx\DoctrineFixtureModule\Executor\ExecutorAwareTrait;
11
use Zend\EventManager\EventManagerAwareTrait;
12
13
/**
14
 * Class AbstractExecuteEventSubscriber
15
 *
16
 * @package Nnx\DoctrineFixtureModule\Listener
17
 */
18
abstract class AbstractExecuteEventSubscriber implements
19
    EventSubscriber,
20
    ExecuteEventSubscriberInterface
21
{
22
    use EventManagerAwareTrait, ExecutorAwareTrait;
23
24
    /**
25
     * Прототип для объекта события
26
     *
27
     * @var FixtureExecutorEvent
28
     */
29
    protected $prototypeEvent;
30
31
    /**
32
     * Возвращает прототип для объекта события
33
     *
34
     * @return FixtureExecutorEvent
35
     */
36
    public function getPrototypeEvent()
37
    {
38
        if (null === $this->prototypeEvent) {
39
            $prototypeEvent = new FixtureExecutorEvent();
40
            $this->setPrototypeEvent($prototypeEvent);
41
        }
42
        return $this->prototypeEvent;
43
    }
44
45
    /**
46
     * Устанавливает прототип для объекта события
47
     *
48
     * @param FixtureExecutorEvent $prototypeEvent
49
     *
50
     * @return $this
51
     */
52
    public function setPrototypeEvent($prototypeEvent)
53
    {
54
        $this->prototypeEvent = $prototypeEvent;
55
56
        return $this;
57
    }
58
}
59