@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $this->log( |
| 245 | 245 | sprintf( |
| 246 | 246 | "Stopped! Memory consumption reached %d MB", |
| 247 | - (int)round(memory_get_peak_usage(true) / 1048576, 2) |
|
| 247 | + (int) round(memory_get_peak_usage(true) / 1048576, 2) |
|
| 248 | 248 | ) |
| 249 | 249 | ); |
| 250 | 250 | return true; |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $this->log( |
| 255 | 255 | sprintf( |
| 256 | 256 | "Stopped! %d total messages consumed!", |
| 257 | - (int)$this->getMessageProcessor()->getProcessedMessages() |
|
| 257 | + (int) $this->getMessageProcessor()->getProcessedMessages() |
|
| 258 | 258 | ) |
| 259 | 259 | ); |
| 260 | 260 | return true; |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | public function consume(AMQPMessage $message) |
| 313 | 313 | { |
| 314 | - $this->log("Received: " . $message->getBody()); |
|
| 314 | + $this->log("Received: ".$message->getBody()); |
|
| 315 | 315 | $this->getMessageProcessor()->consume($message); |
| 316 | 316 | } |
| 317 | 317 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $description = 'Create all queues, exchanges and binds that are defined in entities AND referenced to' . |
|
| 29 | + protected $description = 'Create 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 | "Created 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 create 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 | } |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | $this->output->writeln( |
| 84 | 84 | sprintf( |
| 85 | 85 | "Created entity <info>%s</info> for consumer [<fg=yellow>%s</>]", |
| 86 | - (string)$entity->getAliasName(), |
|
| 87 | - (string)$consumerAliasName |
|
| 86 | + (string) $entity->getAliasName(), |
|
| 87 | + (string) $consumerAliasName |
|
| 88 | 88 | ) |
| 89 | 89 | ); |
| 90 | 90 | } catch (\Exception $e) { |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | $this->output->error( |
| 93 | 93 | sprintf( |
| 94 | 94 | "Could not create entity %s for consumer [%s], got:\n%s", |
| 95 | - (string)$entity->getAliasName(), |
|
| 96 | - (string)$consumerAliasName, |
|
| 97 | - (string)$e->getMessage() |
|
| 95 | + (string) $entity->getAliasName(), |
|
| 96 | + (string) $consumerAliasName, |
|
| 97 | + (string) $e->getMessage() |
|
| 98 | 98 | ) |
| 99 | 99 | ); |
| 100 | 100 | } |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | $this->output->writeln( |
| 110 | 110 | sprintf( |
| 111 | 111 | "Created bind <info>%s</info> for publisher [<fg=yellow>%s</>]", |
| 112 | - (string)$entity->getAliasName(), |
|
| 113 | - (string)$publisherName |
|
| 112 | + (string) $entity->getAliasName(), |
|
| 113 | + (string) $publisherName |
|
| 114 | 114 | ) |
| 115 | 115 | ); |
| 116 | 116 | } catch (\Exception $e) { |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | $this->output->error( |
| 119 | 119 | sprintf( |
| 120 | 120 | "Could not bind entity %s for publisher [%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 | } |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | $this->output->writeln( |
| 134 | 134 | sprintf( |
| 135 | 135 | "Bind entity <info>%s</info> for consumer [<fg=yellow>%s</>]", |
| 136 | - (string)$entity->getAliasName(), |
|
| 137 | - (string)$consumerAliasName |
|
| 136 | + (string) $entity->getAliasName(), |
|
| 137 | + (string) $consumerAliasName |
|
| 138 | 138 | ) |
| 139 | 139 | ); |
| 140 | 140 | } catch (\Exception $e) { |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | $this->output->error( |
| 143 | 143 | sprintf( |
| 144 | 144 | "Could not create bind %s for consumer [%s], got:\n%s", |
| 145 | - (string)$entity->getAliasName(), |
|
| 146 | - (string)$consumerAliasName, |
|
| 147 | - (string)$e->getMessage() |
|
| 145 | + (string) $entity->getAliasName(), |
|
| 146 | + (string) $consumerAliasName, |
|
| 147 | + (string) $e->getMessage() |
|
| 148 | 148 | ) |
| 149 | 149 | ); |
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | - return (int)$hasErrors; |
|
| 152 | + return (int) $hasErrors; |
|
| 153 | 153 | } |
| 154 | 154 | } |
@@ -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,14 +39,14 @@ discard block |
||
| 39 | 39 | $config = config('laravel_rabbitmq'); |
| 40 | 40 | $this->app->singleton( |
| 41 | 41 | Container::class, |
| 42 | - function () use ($config) { |
|
| 42 | + function() use ($config) { |
|
| 43 | 43 | $container = new ContainerBuilder(); |
| 44 | 44 | return $container->createContainer($config); |
| 45 | 45 | } |
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | 48 | // Get "tagged" like Publisher |
| 49 | - $this->app->singleton(PublisherInterface::class, function (Application $application, $arguments) { |
|
| 49 | + $this->app->singleton(PublisherInterface::class, function(Application $application, $arguments) { |
|
| 50 | 50 | /** @var Container $container */ |
| 51 | 51 | $container = $application->make(Container::class); |
| 52 | 52 | if (empty($arguments)) { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | }); |
| 58 | 58 | |
| 59 | 59 | // Get "tagged" like Consumers |
| 60 | - $this->app->singleton(ConsumerInterface::class, function (Application $application, $arguments) { |
|
| 60 | + $this->app->singleton(ConsumerInterface::class, function(Application $application, $arguments) { |
|
| 61 | 61 | /** @var Container $container */ |
| 62 | 62 | $container = $application->make(Container::class); |
| 63 | 63 | if (empty($arguments)) { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | 'lazy' => true, |
| 26 | 26 | |
| 27 | 27 | # More info about timeouts can be found on https://www.rabbitmq.com/networking.html |
| 28 | - 'read_write_timeout' => 8, // default timeout for writing/reading (in seconds) |
|
| 28 | + 'read_write_timeout' => 8, // default timeout for writing/reading (in seconds) |
|
| 29 | 29 | 'connect_timeout' => 10, |
| 30 | 30 | 'heartbeat' => 4 |
| 31 | 31 | ]; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | throw new \InvalidArgumentException( |
| 62 | 62 | sprintf( |
| 63 | 63 | "Cannot create connection %s, received unknown arguments: %s!", |
| 64 | - (string)$aliasName, |
|
| 64 | + (string) $aliasName, |
|
| 65 | 65 | implode(', ', $diff) |
| 66 | 66 | ) |
| 67 | 67 | ); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $this->aliasName = $aliasName; |
| 85 | 85 | $this->connectionDetails = $connectionDetails; |
| 86 | - if (isset($connectionDetails['lazy']) && $connectionDetails['lazy'] === false) { |
|
| 86 | + if (isset($connectionDetails['lazy']) && $connectionDetails['lazy'] === false) { |
|
| 87 | 87 | // dummy call |
| 88 | 88 | $this->getConnection(); |
| 89 | 89 | } |
@@ -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 | } |