@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * @param int $pointer |
| 312 | 312 | * @param string $event |
| 313 | 313 | * @param callable $listener |
| 314 | - * @return callable |
|
| 314 | + * @return \Closure |
|
| 315 | 315 | */ |
| 316 | 316 | protected function attachOnceListener($pointer, $event, callable $listener) |
| 317 | 317 | { |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | * @param string $event |
| 329 | 329 | * @param int $limit |
| 330 | 330 | * @param callable $listener |
| 331 | - * @return callable |
|
| 331 | + * @return \Closure |
|
| 332 | 332 | */ |
| 333 | 333 | protected function attachTimesListener($pointer, $event, $limit, callable $listener) |
| 334 | 334 | { |
@@ -159,7 +159,7 @@ |
||
| 159 | 159 | public function delayTimes($event, $ticks, $limit, callable $listener) |
| 160 | 160 | { |
| 161 | 161 | $counter = 0; |
| 162 | - return $this->times($event, $ticks+$limit-1, function(...$args) use(&$counter, $event, $ticks, $listener) { |
|
| 162 | + return $this->times($event, $ticks + $limit - 1, function(...$args) use(&$counter, $event, $ticks, $listener) { |
|
| 163 | 163 | if (++$counter >= $ticks) |
| 164 | 164 | { |
| 165 | 165 | $listener(...$args); |
@@ -28,7 +28,8 @@ |
||
| 28 | 28 | * |
| 29 | 29 | */ |
| 30 | 30 | public function __construct() |
| 31 | - {} |
|
| 31 | + { |
|
| 32 | +} |
|
| 32 | 33 | |
| 33 | 34 | /** |
| 34 | 35 | * |
@@ -28,6 +28,6 @@ |
||
| 28 | 28 | }); |
| 29 | 29 | |
| 30 | 30 | $counter = 0; |
| 31 | -$emitter->emit('event.number', [ ++$counter ]); |
|
| 32 | -$emitter->emit('event.number', [ ++$counter ]); |
|
| 33 | -$emitter->emit('event.number', [ ++$counter ]); |
|
| 31 | +$emitter->emit('event.number', [ ++$counter]); |
|
| 32 | +$emitter->emit('event.number', [ ++$counter]); |
|
| 33 | +$emitter->emit('event.number', [ ++$counter]); |
|
@@ -31,5 +31,5 @@ |
||
| 31 | 31 | $counterMax = 5; |
| 32 | 32 | |
| 33 | 33 | while ($counter < $counterMax) { |
| 34 | - $emitter->emit('event.number', [ ++$counter ]); |
|
| 34 | + $emitter->emit('event.number', [ ++$counter]); |
|
| 35 | 35 | } |
@@ -30,6 +30,7 @@ |
||
| 30 | 30 | $counter = 0; |
| 31 | 31 | $counterMax = 5; |
| 32 | 32 | |
| 33 | -while ($counter < $counterMax) { |
|
| 33 | +while ($counter < $counterMax) |
|
| 34 | +{ |
|
| 34 | 35 | $emitter->emit('event.number', [ ++$counter ]); |
| 35 | 36 | } |
@@ -26,4 +26,4 @@ |
||
| 26 | 26 | echo "User '$user' has started this script at $time.\n"; |
| 27 | 27 | }); |
| 28 | 28 | |
| 29 | -$emitter->emit('script.start', [ get_current_user(), date('H:i:s Y-m-d') ]); |
|
| 29 | +$emitter->emit('script.start', [get_current_user(), date('H:i:s Y-m-d')]); |
|
@@ -35,5 +35,5 @@ |
||
| 35 | 35 | //$source->copyEvent($target, 'account.pass'); // uncomment this to copy also 'account.pass' event! |
| 36 | 36 | |
| 37 | 37 | // while the emits are being emited on $source emitter. |
| 38 | -$source->emit('account.name', [ 'admin' ]); |
|
| 39 | -$source->emit('account.pass', [ 'admin1234' ]); |
|
| 38 | +$source->emit('account.name', ['admin']); |
|
| 39 | +$source->emit('account.pass', ['admin1234']); |
|
@@ -36,5 +36,5 @@ |
||
| 36 | 36 | $source->forwardEvents($target); |
| 37 | 37 | |
| 38 | 38 | // while the emits are being emited on $source emitter. |
| 39 | -$source->emit('account.name', [ 'admin' ]); |
|
| 40 | -$source->emit('account.pass', [ 'admin1234' ]); |
|
| 39 | +$source->emit('account.name', ['admin']); |
|
| 40 | +$source->emit('account.pass', ['admin1234']); |
|
@@ -32,4 +32,4 @@ |
||
| 32 | 32 | echo "I am 3rd listener and I got new state=$state too!\n"; |
| 33 | 33 | }); |
| 34 | 34 | |
| 35 | -$emitter->emit('state.change', [ 'new_state' ]); |
|
| 35 | +$emitter->emit('state.change', ['new_state']); |
|
@@ -31,5 +31,5 @@ |
||
| 31 | 31 | $counterMax = 5; |
| 32 | 32 | |
| 33 | 33 | while ($counter < $counterMax) { |
| 34 | - $emitter->emit('event.number', [ ++$counter ]); |
|
| 34 | + $emitter->emit('event.number', [ ++$counter]); |
|
| 35 | 35 | } |
@@ -30,6 +30,7 @@ |
||
| 30 | 30 | $counter = 0; |
| 31 | 31 | $counterMax = 5; |
| 32 | 32 | |
| 33 | -while ($counter < $counterMax) { |
|
| 33 | +while ($counter < $counterMax) |
|
| 34 | +{ |
|
| 34 | 35 | $emitter->emit('event.number', [ ++$counter ]); |
| 35 | 36 | } |
@@ -31,5 +31,5 @@ |
||
| 31 | 31 | $counterMax = 5; |
| 32 | 32 | |
| 33 | 33 | while ($counter < $counterMax) { |
| 34 | - $emitter->emit('event.number', [ ++$counter ]); |
|
| 34 | + $emitter->emit('event.number', [ ++$counter]); |
|
| 35 | 35 | } |
@@ -30,6 +30,7 @@ |
||
| 30 | 30 | $counter = 0; |
| 31 | 31 | $counterMax = 5; |
| 32 | 32 | |
| 33 | -while ($counter < $counterMax) { |
|
| 33 | +while ($counter < $counterMax) |
|
| 34 | +{ |
|
| 34 | 35 | $emitter->emit('event.number', [ ++$counter ]); |
| 35 | 36 | } |