@@ -44,8 +44,8 @@ |
||
44 | 44 | */ |
45 | 45 | public function __construct(?string $id = null, ?LoggerInterface $logger = null) |
46 | 46 | { |
47 | - $this->id = (! empty($id) ? $id : self::generateUniqueId()); |
|
48 | - $this->logger = (! empty($logger) ? $logger : new NullLogger()); |
|
47 | + $this->id = (!empty($id) ? $id : self::generateUniqueId()); |
|
48 | + $this->logger = (!empty($logger) ? $logger : new NullLogger()); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | if ( |
132 | 132 | empty($topic['connection']) || |
133 | - ! $container->connections()->has($topic['connection']) |
|
133 | + !$container->connections()->has($topic['connection']) |
|
134 | 134 | ) { |
135 | 135 | throw new \RuntimeException( |
136 | 136 | vsprintf( |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | if ( |
184 | 184 | empty($queue['connection']) || |
185 | - ! $container->connections()->has($queue['connection']) |
|
185 | + !$container->connections()->has($queue['connection']) |
|
186 | 186 | ) { |
187 | 187 | throw new \RuntimeException( |
188 | 188 | vsprintf( |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | if ( |
231 | 231 | empty($publisher['topic']) || |
232 | - ! $container->topics()->has($publisher['topic']) |
|
232 | + !$container->topics()->has($publisher['topic']) |
|
233 | 233 | ) { |
234 | 234 | throw new \RuntimeException( |
235 | 235 | vsprintf( |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | if ( |
278 | 278 | empty($consumer['queue']) || |
279 | - ! $container->queues()->has($consumer['queue']) |
|
279 | + !$container->queues()->has($consumer['queue']) |
|
280 | 280 | ) { |
281 | 281 | throw new \RuntimeException( |
282 | 282 | vsprintf( |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | if (empty($processor)) { |
297 | 297 | $processor = new CallbackProcessor( |
298 | - function () { |
|
298 | + function() { |
|
299 | 299 | return false; |
300 | 300 | } |
301 | 301 | ); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $processor = new $processor(); |
306 | 306 | } |
307 | 307 | |
308 | - if (! ($processor instanceof Processor)) { |
|
308 | + if (!($processor instanceof Processor)) { |
|
309 | 309 | throw new \LogicException( |
310 | 310 | vsprintf( |
311 | 311 | "Can't create processor, '%s' must extend from %s or its child class.", |
@@ -45,7 +45,7 @@ |
||
45 | 45 | */ |
46 | 46 | public function container(): Container |
47 | 47 | { |
48 | - if (! isset($this->container)) { |
|
48 | + if (!isset($this->container)) { |
|
49 | 49 | $this->build(); |
50 | 50 | } |
51 | 51 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $this->extensions = new ExtensionRepository(); |
102 | 102 | |
103 | 103 | $this->tag = ( |
104 | - ! empty($this->tag) |
|
104 | + !empty($this->tag) |
|
105 | 105 | ? $this->tag |
106 | 106 | : vsprintf('[host: %s]-[pid: %s]-[queue: %s]', [gethostname(), getmypid(), $this->queue->name()]) |
107 | 107 | ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $this->dispatcher(true); |
161 | 161 | |
162 | 162 | foreach ($this->extensions->all() as $extension) { |
163 | - if (! is_subclass_of($extension, Extension::class)) { |
|
163 | + if (!is_subclass_of($extension, Extension::class)) { |
|
164 | 164 | throw new Exception( |
165 | 165 | vsprintf( |
166 | 166 | 'The given class, "%s", is not an instance of "%s"', |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | $subscription->subscribe( |
245 | 245 | $consumer, |
246 | - function ($message, $consumer) use ($context) { |
|
246 | + function($message, $consumer) use ($context) { |
|
247 | 247 | return $this->handle($message, $consumer, $context); |
248 | 248 | } |
249 | 249 | ); |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | $route = (string) $this->input->getOption('route'); |
48 | 48 | $data = ''; |
49 | 49 | |
50 | - if (! $this->carrot->container()->publishers()->has($publisherId)) { |
|
50 | + if (!$this->carrot->container()->publishers()->has($publisherId)) { |
|
51 | 51 | $this->error(vsprintf('Publisher "%s" not found.', [$publisherId])); |
52 | 52 | return 0; |
53 | 53 | } |
54 | 54 | |
55 | 55 | $publisher = $this->carrot->container()->publishers()->get($publisherId); |
56 | 56 | |
57 | - while (! feof(STDIN)) { |
|
57 | + while (!feof(STDIN)) { |
|
58 | 58 | $data .= fread(STDIN, 8192); |
59 | 59 | } |
60 | 60 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | $message = MessageBuilder::create()->body($data)->build(); |
66 | 66 | |
67 | - if (! empty($route)) { |
|
67 | + if (!empty($route)) { |
|
68 | 68 | $message->setRoutingKey($route); |
69 | 69 | } |
70 | 70 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | { |
47 | 47 | $consumerId = (string) $this->input->getArgument('consumer'); |
48 | 48 | |
49 | - if (! $this->carrot->container()->consumers()->has($consumerId)) { |
|
49 | + if (!$this->carrot->container()->consumers()->has($consumerId)) { |
|
50 | 50 | $this->error(vsprintf('Consumer "%s" not found.', [$consumerId])); |
51 | 51 | return 0; |
52 | 52 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | $queueId = (string) $this->input->getArgument('queue'); |
39 | 39 | |
40 | - if (! $this->carrot->container()->queues()->has($queueId)) { |
|
40 | + if (!$this->carrot->container()->queues()->has($queueId)) { |
|
41 | 41 | $this->error(vsprintf('Queue "%s" not found.', [$queueId])); |
42 | 42 | return 0; |
43 | 43 | } |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | { |
55 | 55 | $config = config('carrot_mq', []); |
56 | 56 | |
57 | - if (! is_array($config)) { |
|
57 | + if (!is_array($config)) { |
|
58 | 58 | throw new \RuntimeException( |
59 | 59 | 'Invalid configuration provided for CarrotMQ-Laravel!' |
60 | 60 | ); |
61 | 61 | } |
62 | 62 | |
63 | - $this->app->bind('carrot.mq', function (Application $app) { |
|
63 | + $this->app->bind('carrot.mq', function(Application $app) { |
|
64 | 64 | return app(CarrotMQ::class); |
65 | 65 | }); |
66 | 66 | |
67 | - $this->app->singleton(CarrotMQ::class, function (Application $app, $arguments) use ($config) { |
|
67 | + $this->app->singleton(CarrotMQ::class, function(Application $app, $arguments) use ($config) { |
|
68 | 68 | $logger = $app->make(LoggerInterface::class); |
69 | 69 | $carrot = new CarrotMQ($config, $logger); |
70 | 70 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function prepareCommands() |
79 | 79 | { |
80 | - if (! $this->app->runningInConsole()) { |
|
80 | + if (!$this->app->runningInConsole()) { |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | protected function getConfigFile() |
100 | 100 | { |
101 | - return (__DIR__ . '/config/carrot_mq.php'); |
|
101 | + return (__DIR__.'/config/carrot_mq.php'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | protected function dispatcher(bool $fresh = false): EventDispatcher |
26 | 26 | { |
27 | - if ($fresh || ! isset($this->dispatcher)) { |
|
27 | + if ($fresh || !isset($this->dispatcher)) { |
|
28 | 28 | $this->dispatcher = new EventDispatcher(); |
29 | 29 | } |
30 | 30 |