@@ -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 |
@@ -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; |
@@ -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 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $id = null; |
41 | 41 | } |
42 | 42 | if (!empty($id)) { |
43 | - $serialized = $this->executeLuaScript('receive_message', [$queueName, $id]); |
|
43 | + $serialized = $this->executeLuaScript('receive_message', [ $queueName, $id ]); |
|
44 | 44 | if (!empty($serialized)) { |
45 | 45 | return new ReceivedCommand($queueName, $id, $serialized); |
46 | 46 | } |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | |
62 | 62 | public function setCommandCompleted(string $queueName, string $id) |
63 | 63 | { |
64 | - $this->executeLuaScript('acknowledge_message', [$queueName, $id]); |
|
64 | + $this->executeLuaScript('acknowledge_message', [ $queueName, $id ]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | public function setCommandFailed(string $queueName, string $id) |
68 | 68 | { |
69 | - $this->executeLuaScript('reject_message', [$queueName, $id]); |
|
69 | + $this->executeLuaScript('reject_message', [ $queueName, $id ]); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | public function putQueue(string $queueName) |
@@ -110,23 +110,23 @@ discard block |
||
110 | 110 | |
111 | 111 | public function clearQueue(string $queueName) |
112 | 112 | { |
113 | - $this->executeLuaScript('empty_queue', [$queueName]); |
|
113 | + $this->executeLuaScript('empty_queue', [ $queueName ]); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | public function deleteQueue(string $queueName) |
117 | 117 | { |
118 | 118 | $this->clearQueue($queueName); |
119 | - $this->clearSchedule([$queueName]); |
|
119 | + $this->clearSchedule([ $queueName ]); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | public function purgeCommand(string $queueName, string $id) |
123 | 123 | { |
124 | - $this->executeLuaScript('purge_message', [$queueName, $id]); |
|
124 | + $this->executeLuaScript('purge_message', [ $queueName, $id ]); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | public function scheduleCommand(string $queueName, string $id, string $serialized, \DateTime $dateTime) |
128 | 128 | { |
129 | - $this->executeLuaScript('schedule_message', [$queueName, $id, $serialized, $dateTime->getTimestamp()]); |
|
129 | + $this->executeLuaScript('schedule_message', [ $queueName, $id, $serialized, $dateTime->getTimestamp() ]); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | public function cancelScheduledCommand(string $queueName, string $id) |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | private function executeLuaScript(string $script, array $args) |
183 | 183 | { |
184 | - $command = new LuaFileCommand(static::LUA_PATH . '/' . $script . '.lua'); |
|
184 | + $command = new LuaFileCommand(static::LUA_PATH.'/'.$script.'.lua'); |
|
185 | 185 | $command->setArguments($args); |
186 | 186 | return $this->client->executeCommand($command); |
187 | 187 | } |