| @@ 79-91 (lines=13) @@ | ||
| 76 | * |
|
| 77 | * @throws \InvalidArgumentException |
|
| 78 | */ |
|
| 79 | public function onPreDispatchEvent($handler) |
|
| 80 | { |
|
| 81 | if (!is_callable($handler)) { |
|
| 82 | throw new \InvalidArgumentException(sprintf( |
|
| 83 | 'Expected a callable. Got: %s', |
|
| 84 | is_object($handler) ? get_class($handler) : gettype($handler) |
|
| 85 | )); |
|
| 86 | } |
|
| 87 | ||
| 88 | $this->preDispatchHandler = $handler; |
|
| 89 | ||
| 90 | return $this; |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * @param callable $handler |
|
| @@ 100-112 (lines=13) @@ | ||
| 97 | * |
|
| 98 | * @throws \InvalidArgumentException |
|
| 99 | */ |
|
| 100 | public function onPostDispatchEvent($handler) |
|
| 101 | { |
|
| 102 | if (!is_callable($handler)) { |
|
| 103 | throw new \InvalidArgumentException(sprintf( |
|
| 104 | 'Expected a callable. Got: %s', |
|
| 105 | is_object($handler) ? get_class($handler) : gettype($handler) |
|
| 106 | )); |
|
| 107 | } |
|
| 108 | ||
| 109 | $this->postDispatchHandler = $handler; |
|
| 110 | ||
| 111 | return $this; |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * @return callable |
|
| @@ 57-69 (lines=13) @@ | ||
| 54 | * |
|
| 55 | * @return $this |
|
| 56 | */ |
|
| 57 | public function addPreDispatchEventHandler($handler) |
|
| 58 | { |
|
| 59 | if (!is_callable($handler)) { |
|
| 60 | throw new \InvalidArgumentException(sprintf( |
|
| 61 | 'Expected a callable. Got: %s', |
|
| 62 | is_object($handler) ? get_class($handler) : gettype($handler) |
|
| 63 | )); |
|
| 64 | } |
|
| 65 | ||
| 66 | $this->preDispatchHandler = $handler; |
|
| 67 | ||
| 68 | return $this; |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * @param callable $handler |
|
| @@ 76-88 (lines=13) @@ | ||
| 73 | * |
|
| 74 | * @return $this |
|
| 75 | */ |
|
| 76 | public function addPostDispatchEventHandler($handler) |
|
| 77 | { |
|
| 78 | if (!is_callable($handler)) { |
|
| 79 | throw new \InvalidArgumentException(sprintf( |
|
| 80 | 'Expected a callable. Got: %s', |
|
| 81 | is_object($handler) ? get_class($handler) : gettype($handler) |
|
| 82 | )); |
|
| 83 | } |
|
| 84 | ||
| 85 | $this->postDispatchHandler = $handler; |
|
| 86 | ||
| 87 | return $this; |
|
| 88 | } |
|
| 89 | ||
| 90 | /** |
|
| 91 | * @return $this |
|