Completed
Push — master ( b07d3c...864716 )
by Dmitriy
03:01
created

EntityEvent::setData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace T4web\DomainModule;
4
5
use Zend\EventManager\Event;
6
use T4webDomainInterface\EntityInterface;
7
use T4webDomainInterface\EventInterface;
8
9
class EntityEvent extends Event implements EventInterface
10
{
11
    /**
12
     * @var string
13
     */
14
    protected $name;
15
16
    /**
17
     * @var EntityInterface
18
     */
19
    protected $entity;
20
21
    /**
22
     * @var array
23
     */
24
    protected $data = [];
25
26
    /**
27
     * @var array
28
     */
29
    protected $errors = [];
30
31
    /**
32
     * EntityEvent constructor.
33
     * @param string $name
34
     * @param EntityInterface $entity
35
     * @param array $data
36
     */
37
    public function __construct($name, EntityInterface $entity = null, array $data = []) {
38
        $this->name = $name;
39
        $this->entity = $entity;
40
        $this->data = $data;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getName()
47
    {
48
        return $this->name;
49
    }
50
51
    /**
52
     * @return EntityInterface
53
     */
54
    public function getEntity()
55
    {
56
        return $this->entity;
57
    }
58
59
    /**
60
     * @return array
61
     */
62
    public function getData()
63
    {
64
        return $this->data;
65
    }
66
67
    /**
68
     * @param array $data
69
     */
70
    public function setData($data)
71
    {
72
        $this->data = $data;
73
    }
74
75
    /**
76
     * @return array
77
     */
78
    public function getErrors()
79
    {
80
        return $this->errors;
81
    }
82
83
    /**
84
     * @param array $errors
85
     */
86
    public function setErrors(array $errors)
87
    {
88
        $this->errors = $errors;
89
    }
90
}