Total Complexity | 8 |
Total Lines | 80 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
15 | final class Signal implements \Countable, \IteratorAggregate |
||
16 | { |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $name; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | private $arguments; |
||
26 | |||
27 | /** |
||
28 | * @param string $name |
||
29 | * @param mixed ...$arguments |
||
30 | */ |
||
31 | 5 | public function __construct(string $name, ...$arguments) |
|
32 | { |
||
33 | 5 | $this->name = $name; |
|
34 | 5 | $this->arguments = $arguments; |
|
35 | 5 | } |
|
36 | |||
37 | /** |
||
38 | * @param mixed $signal |
||
39 | * @param array $arguments |
||
40 | * |
||
41 | * @return Signal |
||
42 | */ |
||
43 | 5 | public static function create($signal, array $arguments = []): self |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * @return string |
||
59 | */ |
||
60 | 5 | public function name(): string |
|
61 | { |
||
62 | 5 | return $this->name; |
|
63 | } |
||
64 | |||
65 | /** |
||
66 | * @return array |
||
67 | */ |
||
68 | 5 | public function arguments(): array |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * @return string |
||
75 | */ |
||
76 | 1 | public function __toString() |
|
77 | { |
||
78 | 1 | return $this->name; |
|
79 | } |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | 1 | public function getIterator() |
|
85 | { |
||
86 | 1 | yield from $this->arguments; |
|
87 | 1 | } |
|
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | 1 | public function count() |
|
95 | } |
||
96 | } |
||
97 |