| Total Complexity | 5 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class Listener implements ListenerInterface |
||
| 8 | { |
||
| 9 | /** @var string $eventName */ |
||
| 10 | private $eventName; |
||
| 11 | |||
| 12 | /** @var callable $callback */ |
||
| 13 | private $callback; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Listener constructor. |
||
| 17 | * @param string $eventName |
||
| 18 | * @param callable|null $callback |
||
| 19 | */ |
||
| 20 | 3 | public function __construct(string $eventName, callable $callback = null) |
|
| 21 | { |
||
| 22 | 3 | $this->eventName = $eventName; |
|
| 23 | 3 | $this->callback = $callback; |
|
| 24 | 3 | } |
|
| 25 | |||
| 26 | /** |
||
| 27 | * @inheritDoc |
||
| 28 | */ |
||
| 29 | 3 | public function getEventName(): string |
|
| 30 | { |
||
| 31 | 3 | return $this->eventName; |
|
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @inheritDoc |
||
| 36 | */ |
||
| 37 | 1 | public function setEventName(string $eventName): self |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @inheritDoc |
||
| 46 | */ |
||
| 47 | 1 | public function setCallback(callable $callback): ListenerInterface |
|
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @inheritDoc |
||
| 56 | */ |
||
| 57 | 3 | public function notify(EventInterface $event) |
|
| 63 |