@@ -25,12 +25,12 @@ |
||
| 25 | 25 | protected function configure() |
| 26 | 26 | { |
| 27 | 27 | $this->setName('list') |
| 28 | - ->addArgument( |
|
| 29 | - 'workerNamePattern', |
|
| 30 | - InputArgument::OPTIONAL, |
|
| 31 | - 'Regex pattern of the worker name', |
|
| 32 | - null |
|
| 33 | - ) |
|
| 28 | + ->addArgument( |
|
| 29 | + 'workerNamePattern', |
|
| 30 | + InputArgument::OPTIONAL, |
|
| 31 | + 'Regex pattern of the worker name', |
|
| 32 | + null |
|
| 33 | + ) |
|
| 34 | 34 | ->setDescription('List AMQP workers'); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $workerNamePattern = $input->getArgument('workerNamePattern'); |
| 40 | 40 | |
| 41 | - if(!empty($workerNamePattern)) |
|
| 41 | + if( ! empty($workerNamePattern)) |
|
| 42 | 42 | { |
| 43 | 43 | $comment = sprintf('List of worker with following pattern: %s', $workerNamePattern); |
| 44 | 44 | $services = $this->workerProvider->listWithRegexFilter($workerNamePattern); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | $output->writeln(sprintf('<comment>%s</comment>', $comment)); |
| 53 | 53 | |
| 54 | - if(empty($services) || !is_array($services)) |
|
| 54 | + if(empty($services) || ! is_array($services)) |
|
| 55 | 55 | { |
| 56 | 56 | $output->writeln('<error>No worker found</error>'); |
| 57 | 57 | return; |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | user=www-data |
| 73 | 73 | autostart=$autostart |
| 74 | 74 | autorestart=$autorestart |
| 75 | -TXT; |
|
| 75 | +txt; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | private function booleanToString($value) |
@@ -43,12 +43,12 @@ |
||
| 43 | 43 | 'max_execution_time' => self::DEFAULT_MAX_EXECUTION_TIME, |
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | - if(!empty($this->retries)) |
|
| 46 | + if( ! empty($this->retries)) |
|
| 47 | 47 | { |
| 48 | 48 | $options['instant_retry_attempts'] = $this->retries; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - if(!empty($this->delay)) |
|
| 51 | + if( ! empty($this->delay)) |
|
| 52 | 52 | { |
| 53 | 53 | $options['instant_retry_delay'] = $this->delay * 1000000; //computed in microseconds |
| 54 | 54 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | { |
| 79 | 79 | $value = $input->getOption($name); |
| 80 | 80 | |
| 81 | - if(! in_array($value, ['true', 'false'])) |
|
| 81 | + if( ! in_array($value, ['true', 'false'])) |
|
| 82 | 82 | { |
| 83 | 83 | throw new \InvalidArgumentException(sprintf('Invalid value "%s" for option %s, expecting boolean.', $value, $name)); |
| 84 | 84 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | { |
| 36 | 36 | $exchangeParts = []; |
| 37 | 37 | |
| 38 | - if(! empty($this->exchangesPrefix)) |
|
| 38 | + if( ! empty($this->exchangesPrefix)) |
|
| 39 | 39 | { |
| 40 | 40 | $exchangeParts[] = trim($this->exchangesPrefix); |
| 41 | 41 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public static function build($routingKey, Body $body = null, array $additionalHeaders = [], array $additionalAttributes = []) |
| 14 | 14 | { |
| 15 | - if(! $body instanceof Body) |
|
| 15 | + if( ! $body instanceof Body) |
|
| 16 | 16 | { |
| 17 | 17 | $body = new NullBody(); |
| 18 | 18 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | { |
| 45 | 45 | $queueNameParts = []; |
| 46 | 46 | |
| 47 | - if(! empty($this->queueNamePrefix)) |
|
| 47 | + if( ! empty($this->queueNamePrefix)) |
|
| 48 | 48 | { |
| 49 | 49 | $queueNameParts[] = trim($this->queueNamePrefix); |
| 50 | 50 | } |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | $skippedAttributes = array('timestamp', 'headers', 'app_id', 'routing_key'); |
| 110 | 110 | foreach($attributes as $attributeName => $value) |
| 111 | 111 | { |
| 112 | - if(! in_array($attributeName, $skippedAttributes)) |
|
| 112 | + if( ! in_array($attributeName, $skippedAttributes)) |
|
| 113 | 113 | { |
| 114 | 114 | $writable->setAttribute($attributeName, $value); |
| 115 | 115 | } |
@@ -69,7 +69,8 @@ |
||
| 69 | 69 | |
| 70 | 70 | public function __toString(): string |
| 71 | 71 | { |
| 72 | - try { |
|
| 72 | + try |
|
| 73 | + { |
|
| 73 | 74 | return Json::encode([ |
| 74 | 75 | 'routing_key' => $this->getRoutingKey(), |
| 75 | 76 | 'body' => (string) $this->body, |
@@ -103,6 +103,9 @@ discard block |
||
| 103 | 103 | $this->theMessageIs(self::JSON_ROUTING_KEY, ContentType::JSON); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | + /** |
|
| 107 | + * @param string $routingKey |
|
| 108 | + */ |
|
| 106 | 109 | private function theMessageIs($routingKey, $contentType) |
| 107 | 110 | { |
| 108 | 111 | $firstMessage = $this->consumedMessages[0]; |
@@ -145,6 +148,9 @@ discard block |
||
| 145 | 148 | $this->oneOfTheMessagesIs(ContentType::JSON, self::JSON_ROUTING_KEY); |
| 146 | 149 | } |
| 147 | 150 | |
| 151 | + /** |
|
| 152 | + * @param string $routingKey |
|
| 153 | + */ |
|
| 148 | 154 | private function oneOfTheMessagesIs($contentType, $routingKey) |
| 149 | 155 | { |
| 150 | 156 | $found = null; |