@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | { |
9 | 9 | |
10 | 10 | private $baseCommandBus; |
11 | - private $fromQueueCommands = []; |
|
11 | + private $fromQueueCommands = [ ]; |
|
12 | 12 | |
13 | 13 | public function __construct(CommandBusAdapterInterface $baseCommandBus) |
14 | 14 | { |
@@ -19,18 +19,18 @@ discard block |
||
19 | 19 | { |
20 | 20 | if ($fromQueue) { |
21 | 21 | $hash = $this->getHash($command); |
22 | - $this->fromQueueCommands[$hash] = true; |
|
22 | + $this->fromQueueCommands[ $hash ] = true; |
|
23 | 23 | } |
24 | 24 | $this->baseCommandBus->handle($command, $fromQueue); |
25 | 25 | if (isset($hash)) { |
26 | - unset($this->fromQueueCommands[$hash]); |
|
26 | + unset($this->fromQueueCommands[ $hash ]); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function shouldBeQueued($command): bool |
31 | 31 | { |
32 | 32 | $hash = $this->getHash($command); |
33 | - return !isset($this->fromQueueCommands[$hash]); |
|
33 | + return !isset($this->fromQueueCommands[ $hash ]); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | private function getHash($command): string |
@@ -8,12 +8,12 @@ |
||
8 | 8 | /** |
9 | 9 | * @var DeciderInterface[] |
10 | 10 | */ |
11 | - private $deciders = []; |
|
11 | + private $deciders = [ ]; |
|
12 | 12 | |
13 | 13 | public function __construct(array $deciders) |
14 | 14 | { |
15 | 15 | array_walk($deciders, function (DeciderInterface $decider) { |
16 | - $this->deciders[] = $decider; |
|
16 | + $this->deciders[ ] = $decider; |
|
17 | 17 | }); |
18 | 18 | } |
19 | 19 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * @var MethodNameInflector[] |
12 | 12 | */ |
13 | - private $inflectors = []; |
|
13 | + private $inflectors = [ ]; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param MethodNameInflector[] $inflectors |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | public function __construct(array $inflectors) |
19 | 19 | { |
20 | 20 | array_walk($inflectors, function (MethodNameInflector $inflector) { |
21 | - $this->inflectors[] = $inflector; |
|
21 | + $this->inflectors[ ] = $inflector; |
|
22 | 22 | }); |
23 | 23 | } |
24 | 24 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | foreach ($this->inflectors as $inflector) { |
28 | 28 | $methodName = $inflector->inflect($command, $handler); |
29 | - if (is_callable([$handler, $methodName])) { |
|
29 | + if (is_callable([ $handler, $methodName ])) { |
|
30 | 30 | return $methodName; |
31 | 31 | } |
32 | 32 | } |
@@ -8,12 +8,12 @@ |
||
8 | 8 | /** |
9 | 9 | * @var DeciderInterface[] |
10 | 10 | */ |
11 | - private $deciders = []; |
|
11 | + private $deciders = [ ]; |
|
12 | 12 | |
13 | 13 | public function __construct(array $deciders) |
14 | 14 | { |
15 | 15 | array_walk($deciders, function (DeciderInterface $decider) { |
16 | - $this->deciders[] = $decider; |
|
16 | + $this->deciders[ ] = $decider; |
|
17 | 17 | }); |
18 | 18 | } |
19 | 19 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | class PredisAdapter implements QueueAdapterInterface, SchedulerAdapterInterface |
17 | 17 | { |
18 | 18 | |
19 | - const LUA_PATH = __DIR__ . '/../../lua'; |
|
19 | + const LUA_PATH = __DIR__.'/../../lua'; |
|
20 | 20 | |
21 | 21 | private $client; |
22 | 22 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function queueCommand(string $queueName, string $id, string $serialized) |
29 | 29 | { |
30 | - $this->executeLuaScript('queue_message', [$queueName, $id, $serialized]); |
|
30 | + $this->executeLuaScript('queue_message', [ $queueName, $id, $serialized ]); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function awaitCommand(string $queueName, int $timeout = null): ReceivedCommand |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return $this->awaitCommand($queueName, $timeout); |
50 | 50 | } |
51 | 51 | /* @var $id string */ |
52 | - $serialized = $this->executeLuaScript('receive_message', [$queueName, $id]); |
|
52 | + $serialized = $this->executeLuaScript('receive_message', [ $queueName, $id ]); |
|
53 | 53 | return new ReceivedCommand($queueName, $id, $serialized); |
54 | 54 | } |
55 | 55 | |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | |
61 | 61 | public function setCommandCompleted(string $queueName, string $id) |
62 | 62 | { |
63 | - $this->executeLuaScript('acknowledge_message', [$queueName, $id]); |
|
63 | + $this->executeLuaScript('acknowledge_message', [ $queueName, $id ]); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | public function setCommandFailed(string $queueName, string $id) |
67 | 67 | { |
68 | - $this->executeLuaScript('reject_message', [$queueName, $id]); |
|
68 | + $this->executeLuaScript('reject_message', [ $queueName, $id ]); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | public function putQueue(string $queueName) |
@@ -109,23 +109,23 @@ discard block |
||
109 | 109 | |
110 | 110 | public function clearQueue(string $queueName) |
111 | 111 | { |
112 | - $this->executeLuaScript('empty_queue', [$queueName]); |
|
112 | + $this->executeLuaScript('empty_queue', [ $queueName ]); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | public function deleteQueue(string $queueName) |
116 | 116 | { |
117 | 117 | $this->clearQueue($queueName); |
118 | - $this->clearSchedule([$queueName]); |
|
118 | + $this->clearSchedule([ $queueName ]); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | public function purgeCommand(string $queueName, string $id) |
122 | 122 | { |
123 | - $this->executeLuaScript('purge_message', [$queueName, $id]); |
|
123 | + $this->executeLuaScript('purge_message', [ $queueName, $id ]); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | public function scheduleCommand(string $queueName, string $id, string $serialized, \DateTime $dateTime) |
127 | 127 | { |
128 | - $this->executeLuaScript('schedule_message', [$queueName, $id, $serialized, $dateTime->getTimestamp()]); |
|
128 | + $this->executeLuaScript('schedule_message', [ $queueName, $id, $serialized, $dateTime->getTimestamp() ]); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | public function cancelScheduledCommand(string $queueName, string $id) |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | private function executeLuaScript(string $script, array $args) |
182 | 182 | { |
183 | - $command = new LuaFileCommand(static::LUA_PATH . '/' . $script . '.lua'); |
|
183 | + $command = new LuaFileCommand(static::LUA_PATH.'/'.$script.'.lua'); |
|
184 | 184 | $command->setArguments($args); |
185 | 185 | return $this->client->executeCommand($command); |
186 | 186 | } |
@@ -19,8 +19,8 @@ |
||
19 | 19 | { |
20 | 20 | if (is_object($command)) { |
21 | 21 | $class = get_class($command); |
22 | - if (isset($this->map[$class])) { |
|
23 | - return $this->map[$class]; |
|
22 | + if (isset($this->map[ $class ])) { |
|
23 | + return $this->map[ $class ]; |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | throw new QueueResolverException; |