@@ -46,8 +46,7 @@ |
||
46 | 46 | |
47 | 47 | namespace Platine\Event; |
48 | 48 | |
49 | -interface DispatcherInterface |
|
50 | -{ |
|
49 | +interface DispatcherInterface { |
|
51 | 50 | |
52 | 51 | /** |
53 | 52 | * The low priority |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | namespace Platine\Event; |
49 | 49 | |
50 | -class Event implements EventInterface |
|
51 | -{ |
|
50 | +class Event implements EventInterface { |
|
52 | 51 | |
53 | 52 | /** |
54 | 53 | * The event name |
@@ -73,8 +72,7 @@ discard block |
||
73 | 72 | * @param string $name the event name |
74 | 73 | * @param array $arguments the event data |
75 | 74 | */ |
76 | - public function __construct(string $name, array $arguments = []) |
|
77 | - { |
|
75 | + public function __construct(string $name, array $arguments = []) { |
|
78 | 76 | $this->name = $name; |
79 | 77 | $this->arguments = $arguments; |
80 | 78 | } |
@@ -127,8 +125,7 @@ discard block |
||
127 | 125 | * @param string $key |
128 | 126 | * @return mixed |
129 | 127 | */ |
130 | - public function getArgument(string $key) |
|
131 | - { |
|
128 | + public function getArgument(string $key) { |
|
132 | 129 | return array_key_exists($key, $this->arguments) ? $this->arguments[$key] : null; |
133 | 130 | } |
134 | 131 |
@@ -46,8 +46,7 @@ |
||
46 | 46 | |
47 | 47 | namespace Platine\Event; |
48 | 48 | |
49 | -interface ListenerInterface |
|
50 | -{ |
|
49 | +interface ListenerInterface { |
|
51 | 50 | |
52 | 51 | /** |
53 | 52 | * Handle event |
@@ -46,8 +46,7 @@ |
||
46 | 46 | |
47 | 47 | namespace Platine\Event; |
48 | 48 | |
49 | -interface EventInterface |
|
50 | -{ |
|
49 | +interface EventInterface { |
|
51 | 50 | |
52 | 51 | /** |
53 | 52 | * Get the event name |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | namespace Platine\Event; |
48 | 48 | |
49 | -class ListenerPriorityQueue implements \IteratorAggregate |
|
50 | -{ |
|
49 | +class ListenerPriorityQueue implements \IteratorAggregate { |
|
51 | 50 | |
52 | 51 | /** |
53 | 52 | * The storage |
@@ -66,8 +65,7 @@ discard block |
||
66 | 65 | * @param \SplObjectStorage $storage the event name |
67 | 66 | * @param \SplPriorityQueue $queue the priority queue |
68 | 67 | */ |
69 | - public function __construct(\SplObjectStorage $storage = null, \SplPriorityQueue $queue = null) |
|
70 | - { |
|
68 | + public function __construct(\SplObjectStorage $storage = null, \SplPriorityQueue $queue = null) { |
|
71 | 69 | $this->storage = $storage ? $storage : new \SplObjectStorage(); |
72 | 70 | $this->queue = $queue ? $queue : new \SplPriorityQueue(); |
73 | 71 | } |
@@ -46,8 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | namespace Platine\Event; |
48 | 48 | |
49 | -class CallableListener implements ListenerInterface |
|
50 | -{ |
|
49 | +class CallableListener implements ListenerInterface { |
|
51 | 50 | |
52 | 51 | /** |
53 | 52 | * The callable |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | * Create new instance |
66 | 65 | * @param callable $callable |
67 | 66 | */ |
68 | - public function __construct(callable $callable) |
|
69 | - { |
|
67 | + public function __construct(callable $callable) { |
|
70 | 68 | $this->callable = $callable; |
71 | 69 | static::$listeners[] = $this; |
72 | 70 | } |
@@ -96,8 +94,7 @@ discard block |
||
96 | 94 | * @param callable $callable the callable |
97 | 95 | * @return CallableListener|false |
98 | 96 | */ |
99 | - public static function getListener(callable $callable) |
|
100 | - { |
|
97 | + public static function getListener(callable $callable) { |
|
101 | 98 | foreach (static::$listeners as $listener) { |
102 | 99 | if ($listener->getCallable() == $callable) { |
103 | 100 | return $listener; |
@@ -120,8 +117,7 @@ discard block |
||
120 | 117 | * |
121 | 118 | * @return void |
122 | 119 | */ |
123 | - public function handle(EventInterface $event) |
|
124 | - { |
|
120 | + public function handle(EventInterface $event) { |
|
125 | 121 | ($this->callable)($event); |
126 | 122 | } |
127 | 123 | } |
@@ -46,8 +46,7 @@ |
||
46 | 46 | |
47 | 47 | namespace Platine\Event; |
48 | 48 | |
49 | -interface SubscriberInterface |
|
50 | -{ |
|
49 | +interface SubscriberInterface { |
|
51 | 50 | |
52 | 51 | /** |
53 | 52 | * Return the array of event to subscribe in form of |
@@ -48,8 +48,7 @@ |
||
48 | 48 | |
49 | 49 | use Platine\Event\Exception\DispatcherException; |
50 | 50 | |
51 | -class Dispatcher implements DispatcherInterface |
|
52 | -{ |
|
51 | +class Dispatcher implements DispatcherInterface { |
|
53 | 52 | |
54 | 53 | /** |
55 | 54 | * The list of listener |
@@ -32,7 +32,6 @@ |
||
32 | 32 | |
33 | 33 | namespace Platine\Event\Exception; |
34 | 34 | |
35 | -class DispatcherException extends \Exception |
|
36 | -{ |
|
35 | +class DispatcherException extends \Exception { |
|
37 | 36 | |
38 | 37 | } |