@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @var string |
28 | 28 | */ |
29 | - protected $description = 'Delete all queues, exchanges and binds that are defined in entities AND referenced to' . |
|
29 | + protected $description = 'Delete all queues, exchanges and binds that are defined in entities AND referenced to'. |
|
30 | 30 | ' either a publisher or a consumer'; |
31 | 31 | |
32 | 32 | /** |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | $this->output->writeln( |
59 | 59 | sprintf( |
60 | 60 | "Deleted entity <info>%s</info> for publisher [<fg=yellow>%s</>]", |
61 | - (string)$entity->getAliasName(), |
|
62 | - (string)$publisherName |
|
61 | + (string) $entity->getAliasName(), |
|
62 | + (string) $publisherName |
|
63 | 63 | ) |
64 | 64 | ); |
65 | 65 | } catch (\Exception $e) { |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | $this->output->error( |
68 | 68 | sprintf( |
69 | 69 | "Could not delete entity %s for publisher [%s], got:\n%s", |
70 | - (string)$entity->getAliasName(), |
|
71 | - (string)$publisherName, |
|
72 | - (string)$e->getMessage() |
|
70 | + (string) $entity->getAliasName(), |
|
71 | + (string) $publisherName, |
|
72 | + (string) $e->getMessage() |
|
73 | 73 | ) |
74 | 74 | ); |
75 | 75 | } |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | $this->output->writeln( |
83 | 83 | sprintf( |
84 | 84 | "Deleted entity <info>%s</info> for consumer [<fg=yellow>%s</>]", |
85 | - (string)$entity->getAliasName(), |
|
86 | - (string)$consumerAliasName |
|
85 | + (string) $entity->getAliasName(), |
|
86 | + (string) $consumerAliasName |
|
87 | 87 | ) |
88 | 88 | ); |
89 | 89 | } catch (\Exception $e) { |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | $this->output->error( |
92 | 92 | sprintf( |
93 | 93 | "Could not delete entity %s for consumer [%s], got:\n%s", |
94 | - (string)$entity->getAliasName(), |
|
95 | - (string)$consumerAliasName, |
|
96 | - (string)$e->getMessage() |
|
94 | + (string) $entity->getAliasName(), |
|
95 | + (string) $consumerAliasName, |
|
96 | + (string) $e->getMessage() |
|
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | } |
100 | 100 | } |
101 | - return (int)$hasErrors; |
|
101 | + return (int) $hasErrors; |
|
102 | 102 | } |
103 | 103 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function processMessage(AMQPMessage $message): bool |
20 | 20 | { |
21 | - echo $message->getBody() . "\n"; |
|
21 | + echo $message->getBody()."\n"; |
|
22 | 22 | return true; |
23 | 23 | } |
24 | 24 | } |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | throw new \RuntimeException( |
40 | 40 | sprintf( |
41 | 41 | "Cannot create publisher %s: no exchange or queue named %s defined!", |
42 | - (string)$publisherAliasName, |
|
43 | - (string)$publisherEntityBind |
|
42 | + (string) $publisherAliasName, |
|
43 | + (string) $publisherEntityBind |
|
44 | 44 | ) |
45 | 45 | ); |
46 | 46 | } |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | throw new \RuntimeException( |
63 | 63 | sprintf( |
64 | 64 | "Cannot create consumer %s: no queue named %s defined!", |
65 | - (string)$consumerAliasName, |
|
66 | - (string)$consumerDetails['queue'] |
|
65 | + (string) $consumerAliasName, |
|
66 | + (string) $consumerDetails['queue'] |
|
67 | 67 | ) |
68 | 68 | ); |
69 | 69 | } |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | throw new \RuntimeException( |
110 | 110 | sprintf( |
111 | 111 | "Could not create exchange %s: connection name %s is not defined!", |
112 | - (string)$exchangeAliasName, |
|
113 | - (string)$exchangeDetails['connection'] |
|
112 | + (string) $exchangeAliasName, |
|
113 | + (string) $exchangeDetails['connection'] |
|
114 | 114 | ) |
115 | 115 | ); |
116 | 116 | } |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | throw new \RuntimeException( |
143 | 143 | sprintf( |
144 | 144 | "Could not create exchange %s: connection name %s is not defined!", |
145 | - (string)$queueAliasName, |
|
146 | - (string)$queueDetails['connection'] |
|
145 | + (string) $queueAliasName, |
|
146 | + (string) $queueDetails['connection'] |
|
147 | 147 | ) |
148 | 148 | ); |
149 | 149 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | 'lazy' => true, |
15 | 15 | |
16 | 16 | # More info about timeouts can be found on https://www.rabbitmq.com/networking.html |
17 | - 'read_write_timeout' => 8, // default timeout for writing/reading (in seconds) |
|
17 | + 'read_write_timeout' => 8, // default timeout for writing/reading (in seconds) |
|
18 | 18 | 'connect_timeout' => 10, |
19 | 19 | 'heartbeat' => 4 |
20 | 20 | ] |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | $this->stopConsuming(); |
236 | 236 | $this->logger->notice(sprintf( |
237 | 237 | "Stopped consuming: %s in %s:%d", |
238 | - get_class($e) . ' - ' . $e->getMessage(), |
|
239 | - (string)$e->getFile(), |
|
240 | - (int)$e->getLine() |
|
238 | + get_class($e).' - '.$e->getMessage(), |
|
239 | + (string) $e->getFile(), |
|
240 | + (int) $e->getLine() |
|
241 | 241 | )); |
242 | 242 | return 1; |
243 | 243 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | "Stopped consumer", |
266 | 266 | [ |
267 | 267 | 'limit' => 'memory_limit', |
268 | - 'value' => (int)round(memory_get_peak_usage(true) / 1048576, 2) |
|
268 | + 'value' => (int) round(memory_get_peak_usage(true) / 1048576, 2) |
|
269 | 269 | ] |
270 | 270 | ); |
271 | 271 | return true; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | if ($this->getMessageProcessor()->getProcessedMessages() >= $this->limitMessageCount) { |
275 | 275 | $this->logger->debug( |
276 | 276 | "Stopped consumer", |
277 | - ['limit' => 'message_count', 'value' => (int)$this->getMessageProcessor()->getProcessedMessages()] |
|
277 | + ['limit' => 'message_count', 'value' => (int) $this->getMessageProcessor()->getProcessedMessages()] |
|
278 | 278 | ); |
279 | 279 | return true; |
280 | 280 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | try { |
291 | 291 | $this->getChannel()->basic_cancel($this->getConsumerTag(), false, true); |
292 | 292 | } catch (\Throwable $e) { |
293 | - $this->logger->notice("Got " . $e->getMessage() . " of type " . get_class($e)); |
|
293 | + $this->logger->notice("Got ".$e->getMessage()." of type ".get_class($e)); |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | private function registerShutdownHandler() |
342 | 342 | { |
343 | 343 | $consumer = $this; |
344 | - register_shutdown_function(function () use ($consumer) { |
|
344 | + register_shutdown_function(function() use ($consumer) { |
|
345 | 345 | $consumer->stopConsuming(); |
346 | 346 | }); |
347 | 347 | } |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | sprintf( |
412 | 412 | "Got %s from %s in %d", |
413 | 413 | $e->getMessage(), |
414 | - (string)$e->getFile(), |
|
415 | - (int)$e->getLine() |
|
414 | + (string) $e->getFile(), |
|
415 | + (int) $e->getLine() |
|
416 | 416 | ) |
417 | 417 | ); |
418 | 418 | // let the exception slide, the processor should handle |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | $this->logger->error( |
50 | 50 | sprintf( |
51 | 51 | "Could not process message, got %s from %s in %d for message: %s", |
52 | - get_class($e) . '-' . $e->getMessage(), |
|
53 | - (string)$e->getFile(), |
|
54 | - (int)$e->getLine(), |
|
55 | - (string)$message->getBody() |
|
52 | + get_class($e).'-'.$e->getMessage(), |
|
53 | + (string) $e->getFile(), |
|
54 | + (int) $e->getLine(), |
|
55 | + (string) $message->getBody() |
|
56 | 56 | ) |
57 | 57 | ); |
58 | 58 | $this->nack($message); |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | $this->logger->error( |
73 | 73 | sprintf( |
74 | 74 | "Could not process message, got %s from %s in %d for message: %s", |
75 | - get_class($e) . '-' . $e->getMessage(), |
|
76 | - (string)$e->getFile(), |
|
77 | - (int)$e->getLine(), |
|
78 | - (string)$message->getBody() |
|
75 | + get_class($e).'-'.$e->getMessage(), |
|
76 | + (string) $e->getFile(), |
|
77 | + (int) $e->getLine(), |
|
78 | + (string) $message->getBody() |
|
79 | 79 | ) |
80 | 80 | ); |
81 | 81 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'lazy' => true, |
29 | 29 | |
30 | 30 | # More info about timeouts can be found on https://www.rabbitmq.com/networking.html |
31 | - 'read_write_timeout' => 3, // default timeout for writing/reading (in seconds) |
|
31 | + 'read_write_timeout' => 3, // default timeout for writing/reading (in seconds) |
|
32 | 32 | 'connect_timeout' => 3, |
33 | 33 | 'heartbeat' => 0, |
34 | 34 | 'keep_alive' => false |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | throw new \InvalidArgumentException( |
66 | 66 | sprintf( |
67 | 67 | "Cannot create connection %s, received unknown arguments: %s!", |
68 | - (string)$aliasName, |
|
68 | + (string) $aliasName, |
|
69 | 69 | implode(', ', $diff) |
70 | 70 | ) |
71 | 71 | ); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | { |
88 | 88 | $this->aliasName = $aliasName; |
89 | 89 | $this->connectionDetails = $connectionDetails; |
90 | - if (isset($connectionDetails['lazy']) && $connectionDetails['lazy'] === false) { |
|
90 | + if (isset($connectionDetails['lazy']) && $connectionDetails['lazy'] === false) { |
|
91 | 91 | // dummy call |
92 | 92 | $this->getConnection(); |
93 | 93 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @var string |
31 | 31 | */ |
32 | - protected $description = 'Create all queues, exchanges and binds that are defined in entities AND referenced to' . |
|
32 | + protected $description = 'Create all queues, exchanges and binds that are defined in entities AND referenced to'. |
|
33 | 33 | ' either a publisher or a consumer'; |
34 | 34 | |
35 | 35 | /** |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | $this->output->writeln( |
65 | 65 | sprintf( |
66 | 66 | "Deleting <info>%s</info> <fg=yellow>%s</>", |
67 | - (string)($entity instanceof QueueEntity) ? 'QUEUE' : 'EXCHANGE', |
|
68 | - (string)$entity->getAliasName() |
|
67 | + (string) ($entity instanceof QueueEntity) ? 'QUEUE' : 'EXCHANGE', |
|
68 | + (string) $entity->getAliasName() |
|
69 | 69 | ) |
70 | 70 | ); |
71 | 71 | $entity->delete(); |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | $this->output->writeln( |
76 | 76 | sprintf( |
77 | 77 | "Created <info>%s</info> <fg=yellow>%s</> for %s [<fg=yellow>%s</>]", |
78 | - (string)($entity instanceof QueueEntity) ? 'QUEUE' : 'EXCHANGE', |
|
79 | - (string)$entity->getAliasName(), |
|
80 | - (string)$type, |
|
81 | - (string)$resourceName |
|
78 | + (string) ($entity instanceof QueueEntity) ? 'QUEUE' : 'EXCHANGE', |
|
79 | + (string) $entity->getAliasName(), |
|
80 | + (string) $type, |
|
81 | + (string) $resourceName |
|
82 | 82 | ) |
83 | 83 | ); |
84 | 84 | } |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | $this->output->error( |
101 | 101 | sprintf( |
102 | 102 | "Could not create entity %s for publisher [%s], got:\n%s", |
103 | - (string)$entity->getAliasName(), |
|
104 | - (string)$publisherName, |
|
105 | - (string)$e->getMessage() |
|
103 | + (string) $entity->getAliasName(), |
|
104 | + (string) $publisherName, |
|
105 | + (string) $e->getMessage() |
|
106 | 106 | ) |
107 | 107 | ); |
108 | 108 | $entity->reconnect(); |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | $this->output->error( |
119 | 119 | sprintf( |
120 | 120 | "Could not create entity %s for consumer [%s], got:\n%s", |
121 | - (string)$entity->getAliasName(), |
|
122 | - (string)$publisherName, |
|
123 | - (string)$e->getMessage() |
|
121 | + (string) $entity->getAliasName(), |
|
122 | + (string) $publisherName, |
|
123 | + (string) $e->getMessage() |
|
124 | 124 | ) |
125 | 125 | ); |
126 | 126 | $entity->reconnect(); |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | $this->output->writeln( |
136 | 136 | sprintf( |
137 | 137 | "Created bind <info>%s</info> for publisher [<fg=yellow>%s</>]", |
138 | - (string)$entity->getAliasName(), |
|
139 | - (string)$publisherName |
|
138 | + (string) $entity->getAliasName(), |
|
139 | + (string) $publisherName |
|
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | } catch (\Exception $e) { |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | $this->output->error( |
145 | 145 | sprintf( |
146 | 146 | "Could not bind entity %s for publisher [%s], got:\n%s", |
147 | - (string)$entity->getAliasName(), |
|
148 | - (string)$publisherName, |
|
149 | - (string)$e->getMessage() |
|
147 | + (string) $entity->getAliasName(), |
|
148 | + (string) $publisherName, |
|
149 | + (string) $e->getMessage() |
|
150 | 150 | ) |
151 | 151 | ); |
152 | 152 | } |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | $this->output->writeln( |
160 | 160 | sprintf( |
161 | 161 | "Bind entity <info>%s</info> for consumer [<fg=yellow>%s</>]", |
162 | - (string)$entity->getAliasName(), |
|
163 | - (string)$consumerAliasName |
|
162 | + (string) $entity->getAliasName(), |
|
163 | + (string) $consumerAliasName |
|
164 | 164 | ) |
165 | 165 | ); |
166 | 166 | } catch (\Exception $e) { |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | $this->output->error( |
169 | 169 | sprintf( |
170 | 170 | "Could not create bind %s for consumer [%s], got:\n%s", |
171 | - (string)$entity->getAliasName(), |
|
172 | - (string)$consumerAliasName, |
|
173 | - (string)$e->getMessage() |
|
171 | + (string) $entity->getAliasName(), |
|
172 | + (string) $consumerAliasName, |
|
173 | + (string) $e->getMessage() |
|
174 | 174 | ) |
175 | 175 | ); |
176 | 176 | } |
177 | 177 | } |
178 | - return (int)$hasErrors; |
|
178 | + return (int) $hasErrors; |
|
179 | 179 | } |
180 | 180 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $this->publishes([ |
64 | 64 | realpath( |
65 | 65 | dirname(__FILE__) |
66 | - ) . '/../../config/laravel_rabbitmq.php' => config_path('laravel_rabbitmq.php'), |
|
66 | + ).'/../../config/laravel_rabbitmq.php' => config_path('laravel_rabbitmq.php'), |
|
67 | 67 | ]); |
68 | 68 | } |
69 | 69 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $this->app->singleton( |
85 | 85 | Container::class, |
86 | - function () use ($config) { |
|
86 | + function() use ($config) { |
|
87 | 87 | $container = new ContainerBuilder(); |
88 | 88 | return $container->createContainer($config); |
89 | 89 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | private function registerPublishers() |
97 | 97 | { |
98 | 98 | // Get "tagged" like Publisher |
99 | - $this->app->singleton(PublisherInterface::class, function ($application, $arguments) { |
|
99 | + $this->app->singleton(PublisherInterface::class, function($application, $arguments) { |
|
100 | 100 | /** @var Container $container */ |
101 | 101 | $container = $application->make(Container::class); |
102 | 102 | if (empty($arguments)) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | private function registerConsumers() |
114 | 114 | { |
115 | 115 | // Get "tagged" like Consumers |
116 | - $this->app->singleton(ConsumerInterface::class, function ($application, $arguments) { |
|
116 | + $this->app->singleton(ConsumerInterface::class, function($application, $arguments) { |
|
117 | 117 | /** @var Container $container */ |
118 | 118 | $container = $application->make(Container::class); |
119 | 119 | if (empty($arguments)) { |