Total Complexity | 5 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
11 | trait HasNameTrait |
||
12 | { |
||
13 | protected $name = null; |
||
14 | |||
15 | 6 | public function eventName(): string |
|
16 | { |
||
17 | 6 | return $this->getName(); |
|
18 | 5 | } |
|
19 | |||
20 | 6 | public function getName() |
|
21 | { |
||
22 | if ($this->name === null) { |
||
23 | $this->name = get_called_class(); |
||
24 | } |
||
25 | return $this->name; |
||
26 | 3 | } |
|
27 | |||
28 | 3 | /** |
|
29 | 3 | * @param null $name |
|
|
|||
30 | */ |
||
31 | public function setName($name) |
||
32 | { |
||
33 | $this->name = $name; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Create a new event instance. |
||
38 | 3 | * |
|
39 | * @param string $name |
||
40 | 3 | * @param mixed ...$arguments |
|
41 | 3 | * @return EventInterface|static |
|
42 | 3 | */ |
|
43 | public static function named($name, ... $arguments) |
||
48 | } |
||
49 | } |
||
50 |