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