@@ -5,7 +5,7 @@ |
||
5 | 5 | class SystemClock implements ClockInterface |
6 | 6 | { |
7 | 7 | |
8 | - public function getTime(): \DateTime |
|
8 | + public function getTime (): \DateTime |
|
9 | 9 | { |
10 | 10 | return new \DateTime(); |
11 | 11 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | private $commandBusAdapter; |
15 | 15 | private $errorHandler; |
16 | 16 | |
17 | - public function __construct( |
|
17 | + public function __construct ( |
|
18 | 18 | QueueResolverInterface $queueResolver, |
19 | 19 | CommandSerializerInterface $commandSerializer, |
20 | 20 | CommandIdGeneratorInterface $commandIdGenerator, |
@@ -34,42 +34,42 @@ discard block |
||
34 | 34 | $this->errorHandler = $errorHandler; |
35 | 35 | } |
36 | 36 | |
37 | - public function getQueueResolver(): QueueResolverInterface |
|
37 | + public function getQueueResolver (): QueueResolverInterface |
|
38 | 38 | { |
39 | 39 | return $this->queueResolver; |
40 | 40 | } |
41 | 41 | |
42 | - public function getCommandSerializer(): CommandSerializerInterface |
|
42 | + public function getCommandSerializer (): CommandSerializerInterface |
|
43 | 43 | { |
44 | 44 | return $this->commandSerializer; |
45 | 45 | } |
46 | 46 | |
47 | - public function getCommandIdGenerator(): CommandIdGeneratorInterface |
|
47 | + public function getCommandIdGenerator (): CommandIdGeneratorInterface |
|
48 | 48 | { |
49 | 49 | return $this->commandIdGenerator; |
50 | 50 | } |
51 | 51 | |
52 | - public function getQueueAdapter(): QueueAdapterInterface |
|
52 | + public function getQueueAdapter (): QueueAdapterInterface |
|
53 | 53 | { |
54 | 54 | return $this->queueAdapter; |
55 | 55 | } |
56 | 56 | |
57 | - public function getSchedulerAdapter(): SchedulerAdapterInterface |
|
57 | + public function getSchedulerAdapter (): SchedulerAdapterInterface |
|
58 | 58 | { |
59 | 59 | return $this->schedulerAdapter; |
60 | 60 | } |
61 | 61 | |
62 | - public function getClock(): ClockInterface |
|
62 | + public function getClock (): ClockInterface |
|
63 | 63 | { |
64 | 64 | return $this->clock; |
65 | 65 | } |
66 | 66 | |
67 | - public function getCommandBusAdapter(): CommandBusAdapterInterface |
|
67 | + public function getCommandBusAdapter (): CommandBusAdapterInterface |
|
68 | 68 | { |
69 | 69 | return $this->commandBusAdapter; |
70 | 70 | } |
71 | 71 | |
72 | - public function getErrorHandler(): ErrorHandlerInterface |
|
72 | + public function getErrorHandler (): ErrorHandlerInterface |
|
73 | 73 | { |
74 | 74 | return $this->errorHandler; |
75 | 75 | } |
@@ -5,5 +5,5 @@ |
||
5 | 5 | interface CommandBusAdapterInterface |
6 | 6 | { |
7 | 7 | |
8 | - public function handle($command); |
|
8 | + public function handle ($command); |
|
9 | 9 | } |
@@ -9,24 +9,24 @@ |
||
9 | 9 | private $id; |
10 | 10 | private $serialized; |
11 | 11 | |
12 | - public function __construct(string $queueName, string $id, string $serialized) |
|
12 | + public function __construct (string $queueName, string $id, string $serialized) |
|
13 | 13 | { |
14 | 14 | $this->queueName = $queueName; |
15 | 15 | $this->id = $id; |
16 | 16 | $this->serialized = $serialized; |
17 | 17 | } |
18 | 18 | |
19 | - public function getQueueName(): string |
|
19 | + public function getQueueName (): string |
|
20 | 20 | { |
21 | 21 | return $this->queueName; |
22 | 22 | } |
23 | 23 | |
24 | - public function getId(): string |
|
24 | + public function getId (): string |
|
25 | 25 | { |
26 | 26 | return $this->id; |
27 | 27 | } |
28 | 28 | |
29 | - public function getSerialized(): string |
|
29 | + public function getSerialized (): string |
|
30 | 30 | { |
31 | 31 | return $this->serialized; |
32 | 32 | } |
@@ -15,29 +15,29 @@ discard block |
||
15 | 15 | const STATUS_FAILED = 'failed'; |
16 | 16 | const STATUS_NOT_FOUND = 'not_found'; |
17 | 17 | |
18 | - public function queueCommand(string $queueName, string $id, string $serialized); |
|
18 | + public function queueCommand (string $queueName, string $id, string $serialized); |
|
19 | 19 | |
20 | - public function getCommandStatus(string $queueName, string $id): string; |
|
20 | + public function getCommandStatus (string $queueName, string $id): string; |
|
21 | 21 | |
22 | - public function setCommandCompleted(string $queueName, string $id); |
|
22 | + public function setCommandCompleted (string $queueName, string $id); |
|
23 | 23 | |
24 | - public function setCommandFailed(string $queueName, string $id); |
|
24 | + public function setCommandFailed (string $queueName, string $id); |
|
25 | 25 | |
26 | - public function getQueueNames(): array; |
|
26 | + public function getQueueNames (): array; |
|
27 | 27 | |
28 | - public function getQueuedCount(string $queueName): int; |
|
28 | + public function getQueuedCount (string $queueName): int; |
|
29 | 29 | |
30 | - public function getConsumingCount(string $queueName): int; |
|
30 | + public function getConsumingCount (string $queueName): int; |
|
31 | 31 | |
32 | - public function emptyQueue(string $queueName); |
|
32 | + public function emptyQueue (string $queueName); |
|
33 | 33 | |
34 | - public function putQueue(string $queueName); |
|
34 | + public function putQueue (string $queueName); |
|
35 | 35 | |
36 | - public function purgeCommand(string $queueName, string $id); |
|
36 | + public function purgeCommand (string $queueName, string $id); |
|
37 | 37 | |
38 | - public function getQueuedIds(string $queueName, int $offset = 0, int $limit = 10): array; |
|
38 | + public function getQueuedIds (string $queueName, int $offset = 0, int $limit = 10): array; |
|
39 | 39 | |
40 | - public function getConsumingIds(string $queueName, int $offset = 0, int $limit = 10): array; |
|
40 | + public function getConsumingIds (string $queueName, int $offset = 0, int $limit = 10): array; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @param string $queueName |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | * @return string The serialized command |
46 | 46 | * @throws CommandNotFoundException |
47 | 47 | */ |
48 | - public function readCommand(string $queueName, string $id): string; |
|
48 | + public function readCommand (string $queueName, string $id): string; |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @param string $queueName |
52 | 52 | * @return ReceivedCommand |
53 | 53 | * @throws TimeoutException |
54 | 54 | */ |
55 | - public function awaitCommand(string $queueName, int $timeout = null): ReceivedCommand; |
|
55 | + public function awaitCommand (string $queueName, int $timeout = null): ReceivedCommand; |
|
56 | 56 | } |
@@ -12,19 +12,19 @@ |
||
12 | 12 | private $type; |
13 | 13 | private $format; |
14 | 14 | |
15 | - public function __construct(SerializerInterface $jmsSerializer, string $type, string $format = 'json') |
|
15 | + public function __construct (SerializerInterface $jmsSerializer, string $type, string $format = 'json') |
|
16 | 16 | { |
17 | 17 | $this->jmsSerializer = $jmsSerializer; |
18 | 18 | $this->type = $type; |
19 | 19 | $this->format = $format; |
20 | 20 | } |
21 | 21 | |
22 | - public function serialize($command): string |
|
22 | + public function serialize ($command): string |
|
23 | 23 | { |
24 | 24 | return $this->jmsSerializer->serialize($command, $this->format); |
25 | 25 | } |
26 | 26 | |
27 | - public function unserialize(string $serialized) |
|
27 | + public function unserialize (string $serialized) |
|
28 | 28 | { |
29 | 29 | return $this->jmsSerializer->deserialize($serialized, $this->type, $this->format); |
30 | 30 | } |
@@ -7,12 +7,12 @@ |
||
7 | 7 | class PHPCommandSerializer implements CommandSerializerInterface |
8 | 8 | { |
9 | 9 | |
10 | - public function serialize($command): string |
|
10 | + public function serialize ($command): string |
|
11 | 11 | { |
12 | 12 | return serialize($command); |
13 | 13 | } |
14 | 14 | |
15 | - public function unserialize(string $serialized) |
|
15 | + public function unserialize (string $serialized) |
|
16 | 16 | { |
17 | 17 | return unserialize($serialized); |
18 | 18 | } |
@@ -12,18 +12,18 @@ |
||
12 | 12 | private $packer; |
13 | 13 | private $unpacker; |
14 | 14 | |
15 | - public function __construct(Packer $packer, BufferUnpacker $unpacker) |
|
15 | + public function __construct (Packer $packer, BufferUnpacker $unpacker) |
|
16 | 16 | { |
17 | 17 | $this->packer = $packer; |
18 | 18 | $this->unpacker = $unpacker; |
19 | 19 | } |
20 | 20 | |
21 | - public function serialize($command): string |
|
21 | + public function serialize ($command): string |
|
22 | 22 | { |
23 | 23 | return $this->packer->pack($command); |
24 | 24 | } |
25 | 25 | |
26 | - public function unserialize(string $serialized) |
|
26 | + public function unserialize (string $serialized) |
|
27 | 27 | { |
28 | 28 | return $this->unpacker->reset($serialized)->unpack(); |
29 | 29 | } |
@@ -7,26 +7,26 @@ |
||
7 | 7 | |
8 | 8 | private $implementation; |
9 | 9 | |
10 | - public function __construct(Implementation $implementation) |
|
10 | + public function __construct (Implementation $implementation) |
|
11 | 11 | { |
12 | 12 | $this->implementation = $implementation; |
13 | 13 | } |
14 | 14 | |
15 | - public function handleQueued(QueuedCommand $queuedCommand) |
|
15 | + public function handleQueued (QueuedCommand $queuedCommand) |
|
16 | 16 | { |
17 | 17 | list($queueName, $id, $serialized) = $this->process($queuedCommand); |
18 | 18 | $this->implementation->getQueueAdapter() |
19 | 19 | ->queueCommand($queueName, $id, $serialized); |
20 | 20 | } |
21 | 21 | |
22 | - public function handleScheduled(ScheduledCommand $scheduledCommand) |
|
22 | + public function handleScheduled (ScheduledCommand $scheduledCommand) |
|
23 | 23 | { |
24 | 24 | list($queueName, $id, $serialized) = $this->process($scheduledCommand); |
25 | 25 | $this->implementation->getSchedulerAdapter() |
26 | 26 | ->scheduleCommand($queueName, $id, $serialized, $scheduledCommand->getDateTime()); |
27 | 27 | } |
28 | 28 | |
29 | - private function process(BusQueCommandInterface $command): array |
|
29 | + private function process (BusQueCommandInterface $command): array |
|
30 | 30 | { |
31 | 31 | $baseCommand = $command->getCommand(); |
32 | 32 | $queueName = $this->implementation->getQueueResolver() |