@@ -46,8 +46,7 @@ |
||
46 | 46 | |
47 | 47 | namespace Platine\Event; |
48 | 48 | |
49 | -interface EventInterface |
|
50 | -{ |
|
49 | +interface EventInterface { |
|
51 | 50 | /** |
52 | 51 | * Get the event name |
53 | 52 | * @return string |
@@ -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 | * The callable |
53 | 52 | * @var callable |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | * Create new instance |
65 | 64 | * @param callable $callable |
66 | 65 | */ |
67 | - public function __construct(callable $callable) |
|
68 | - { |
|
66 | + public function __construct(callable $callable) { |
|
69 | 67 | $this->callable = $callable; |
70 | 68 | static::$listeners[] = $this; |
71 | 69 | } |
@@ -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; |
@@ -121,8 +118,7 @@ discard block |
||
121 | 118 | * |
122 | 119 | * @return void |
123 | 120 | */ |
124 | - public function handle(EventInterface $event) |
|
125 | - { |
|
121 | + public function handle(EventInterface $event) { |
|
126 | 122 | ($this->callable)($event); |
127 | 123 | } |
128 | 124 | } |
@@ -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 | * The list of listener |
55 | 54 | * @var array<string, ListenerPriorityQueue> |
@@ -46,8 +46,7 @@ |
||
46 | 46 | |
47 | 47 | namespace Platine\Event; |
48 | 48 | |
49 | -interface SubscriberInterface |
|
50 | -{ |
|
49 | +interface SubscriberInterface { |
|
51 | 50 | /** |
52 | 51 | * Return the array of event to subscribe in form of |
53 | 52 | * |
@@ -46,8 +46,7 @@ |
||
46 | 46 | |
47 | 47 | namespace Platine\Event; |
48 | 48 | |
49 | -interface ListenerInterface |
|
50 | -{ |
|
49 | +interface ListenerInterface { |
|
51 | 50 | /** |
52 | 51 | * Handle event |
53 | 52 | * @param EventInterface $event the event instance |
@@ -56,8 +56,7 @@ |
||
56 | 56 | * |
57 | 57 | * @implements IteratorAggregate<ListenerInterface> |
58 | 58 | */ |
59 | -class ListenerPriorityQueue implements IteratorAggregate |
|
60 | -{ |
|
59 | +class ListenerPriorityQueue implements IteratorAggregate { |
|
61 | 60 | /** |
62 | 61 | * The storage |
63 | 62 | * @var SplObjectStorage<ListenerInterface, int> |
@@ -48,8 +48,7 @@ |
||
48 | 48 | |
49 | 49 | use SplPriorityQueue; |
50 | 50 | |
51 | -interface DispatcherInterface |
|
52 | -{ |
|
51 | +interface DispatcherInterface { |
|
53 | 52 | /** |
54 | 53 | * The low priority |
55 | 54 | * @var int |
@@ -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 | * The event name |
54 | 53 | * @var string |
@@ -72,8 +71,7 @@ discard block |
||
72 | 71 | * @param string $name the event name |
73 | 72 | * @param array<string, mixed> $arguments the event data |
74 | 73 | */ |
75 | - public function __construct(string $name, array $arguments = []) |
|
76 | - { |
|
74 | + public function __construct(string $name, array $arguments = []) { |
|
77 | 75 | $this->name = $name; |
78 | 76 | $this->arguments = $arguments; |
79 | 77 | } |
@@ -126,8 +124,7 @@ discard block |
||
126 | 124 | * @param string $key |
127 | 125 | * @return mixed|null |
128 | 126 | */ |
129 | - public function getArgument(string $key) |
|
130 | - { |
|
127 | + public function getArgument(string $key) { |
|
131 | 128 | return array_key_exists($key, $this->arguments) |
132 | 129 | ? $this->arguments[$key] |
133 | 130 | : null; |