@@ -30,84 +30,84 @@ |
||
| 30 | 30 | |
| 31 | 31 | class GenericEventWrapper extends GenericEvent { |
| 32 | 32 | |
| 33 | - /** @var ILogger */ |
|
| 34 | - private $logger; |
|
| 35 | - |
|
| 36 | - /** @var GenericEvent */ |
|
| 37 | - private $event; |
|
| 38 | - |
|
| 39 | - /** @var string */ |
|
| 40 | - private $eventName; |
|
| 41 | - |
|
| 42 | - public function __construct(ILogger $logger, string $eventName, ?GenericEvent $event) { |
|
| 43 | - parent::__construct($eventName); |
|
| 44 | - $this->logger = $logger; |
|
| 45 | - $this->event = $event; |
|
| 46 | - $this->eventName = $eventName; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - private function log() { |
|
| 50 | - $class = ($this->event !== null && is_object($this->event)) ? get_class($this->event) : 'null'; |
|
| 51 | - $this->logger->info( |
|
| 52 | - 'Deprecated event type for {name}: {class} is used', |
|
| 53 | - [ 'name' => $this->eventName, 'class' => $class] |
|
| 54 | - ); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - public function isPropagationStopped(): bool { |
|
| 58 | - $this->log(); |
|
| 59 | - return $this->event->isPropagationStopped(); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - public function stopPropagation(): void { |
|
| 63 | - $this->log(); |
|
| 64 | - $this->event->stopPropagation(); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - public function getSubject() { |
|
| 68 | - $this->log(); |
|
| 69 | - return $this->event->getSubject(); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - public function getArgument($key) { |
|
| 73 | - $this->log(); |
|
| 74 | - return $this->event->getArgument($key); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - public function setArgument($key, $value) { |
|
| 78 | - $this->log(); |
|
| 79 | - return $this->event->setArgument($key, $value); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - public function getArguments() { |
|
| 83 | - return $this->event->getArguments(); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - public function setArguments(array $args = []) { |
|
| 87 | - return $this->event->setArguments($args); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - public function hasArgument($key) { |
|
| 91 | - return $this->event->hasArgument($key); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - public function offsetGet($key) { |
|
| 95 | - return $this->event->offsetGet($key); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - public function offsetSet($key, $value) { |
|
| 99 | - return $this->event->offsetSet($key, $value); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - public function offsetUnset($key) { |
|
| 103 | - return $this->event->offsetUnset($key); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - public function offsetExists($key) { |
|
| 107 | - return $this->event->offsetExists($key); |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - public function getIterator() { |
|
| 111 | - return$this->event->getIterator(); |
|
| 112 | - } |
|
| 33 | + /** @var ILogger */ |
|
| 34 | + private $logger; |
|
| 35 | + |
|
| 36 | + /** @var GenericEvent */ |
|
| 37 | + private $event; |
|
| 38 | + |
|
| 39 | + /** @var string */ |
|
| 40 | + private $eventName; |
|
| 41 | + |
|
| 42 | + public function __construct(ILogger $logger, string $eventName, ?GenericEvent $event) { |
|
| 43 | + parent::__construct($eventName); |
|
| 44 | + $this->logger = $logger; |
|
| 45 | + $this->event = $event; |
|
| 46 | + $this->eventName = $eventName; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + private function log() { |
|
| 50 | + $class = ($this->event !== null && is_object($this->event)) ? get_class($this->event) : 'null'; |
|
| 51 | + $this->logger->info( |
|
| 52 | + 'Deprecated event type for {name}: {class} is used', |
|
| 53 | + [ 'name' => $this->eventName, 'class' => $class] |
|
| 54 | + ); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + public function isPropagationStopped(): bool { |
|
| 58 | + $this->log(); |
|
| 59 | + return $this->event->isPropagationStopped(); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + public function stopPropagation(): void { |
|
| 63 | + $this->log(); |
|
| 64 | + $this->event->stopPropagation(); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + public function getSubject() { |
|
| 68 | + $this->log(); |
|
| 69 | + return $this->event->getSubject(); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + public function getArgument($key) { |
|
| 73 | + $this->log(); |
|
| 74 | + return $this->event->getArgument($key); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + public function setArgument($key, $value) { |
|
| 78 | + $this->log(); |
|
| 79 | + return $this->event->setArgument($key, $value); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + public function getArguments() { |
|
| 83 | + return $this->event->getArguments(); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + public function setArguments(array $args = []) { |
|
| 87 | + return $this->event->setArguments($args); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + public function hasArgument($key) { |
|
| 91 | + return $this->event->hasArgument($key); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + public function offsetGet($key) { |
|
| 95 | + return $this->event->offsetGet($key); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + public function offsetSet($key, $value) { |
|
| 99 | + return $this->event->offsetSet($key, $value); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + public function offsetUnset($key) { |
|
| 103 | + return $this->event->offsetUnset($key); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + public function offsetExists($key) { |
|
| 107 | + return $this->event->offsetExists($key); |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + public function getIterator() { |
|
| 111 | + return$this->event->getIterator(); |
|
| 112 | + } |
|
| 113 | 113 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $class = ($this->event !== null && is_object($this->event)) ? get_class($this->event) : 'null'; |
| 51 | 51 | $this->logger->info( |
| 52 | 52 | 'Deprecated event type for {name}: {class} is used', |
| 53 | - [ 'name' => $this->eventName, 'class' => $class] |
|
| 53 | + ['name' => $this->eventName, 'class' => $class] |
|
| 54 | 54 | ); |
| 55 | 55 | } |
| 56 | 56 | |