@@ -19,6 +19,12 @@ |
||
| 19 | 19 | $this->overwrite = true; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | + /** |
|
| 23 | + * @param boolean $autostart |
|
| 24 | + * @param boolean $autorestart |
|
| 25 | + * @param string $appId |
|
| 26 | + * @param string $destination |
|
| 27 | + */ |
|
| 22 | 28 | public function generate(array $workers, $autostart, $autorestart, $server, $appId, $destination, OutputInterface $output) |
| 23 | 29 | { |
| 24 | 30 | foreach($workers as $worker => $data) |
@@ -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) |
@@ -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; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function applyHooks(MessageHookCollection $messageHookCollection) |
| 67 | 67 | { |
| 68 | - if(!empty($messageHookCollection)) |
|
| 68 | + if( ! empty($messageHookCollection)) |
|
| 69 | 69 | { |
| 70 | 70 | foreach($messageHookCollection as $messageHook) |
| 71 | 71 | { |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | $retryHeader = $this->getHeader(\Puzzle\AMQP\Consumers\Retry::DEFAULT_RETRY_HEADER); |
| 153 | 153 | |
| 154 | - return (!empty($retryHeader) && (int) $retryHeader === $retryOccurence); |
|
| 154 | + return ( ! empty($retryHeader) && (int) $retryHeader === $retryOccurence); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function getRoutingKeyFromHeader() |
| 158 | 158 | { |
| 159 | 159 | $headers = $this->getHeaders(); |
| 160 | 160 | |
| 161 | - if(! array_key_exists('routing_key', $headers)) |
|
| 161 | + if( ! array_key_exists('routing_key', $headers)) |
|
| 162 | 162 | { |
| 163 | 163 | return null; |
| 164 | 164 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | $hooks = $this->workerContext->getMessageHooks(); |
| 27 | 27 | |
| 28 | - if(!empty($hooks)) |
|
| 28 | + if( ! empty($hooks)) |
|
| 29 | 29 | { |
| 30 | 30 | $message->applyHooks($hooks); |
| 31 | 31 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | public function deployInstances($numberOfInstance) |
| 101 | 101 | { |
| 102 | - if(! empty($numberOfInstance)) |
|
| 102 | + if( ! empty($numberOfInstance)) |
|
| 103 | 103 | { |
| 104 | 104 | $this->instances = (int) $numberOfInstance; |
| 105 | 105 | } |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | public function deployOn($servers) |
| 116 | 116 | { |
| 117 | - if(! empty($servers)) |
|
| 117 | + if( ! empty($servers)) |
|
| 118 | 118 | { |
| 119 | - if(! is_array($servers)) |
|
| 119 | + if( ! is_array($servers)) |
|
| 120 | 120 | { |
| 121 | 121 | $servers = [$servers]; |
| 122 | 122 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | { |
| 28 | 28 | $retryHeader = $this->getHeader(\Puzzle\AMQP\Consumers\Retry::DEFAULT_RETRY_HEADER); |
| 29 | 29 | |
| 30 | - return (!empty($retryHeader) && (int) $retryHeader === $retryOccurence); |
|
| 30 | + return ( ! empty($retryHeader) && (int) $retryHeader === $retryOccurence); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function applyHooks(MessageHookCollection $messageHookCollection) |
@@ -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 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | 'retry_key_pattern' => sprintf(self::RETRY_ROUTING_KEY_PATTERN, $workerContext->queue), |
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | - if(! empty($this->retries)) |
|
| 55 | + if( ! empty($this->retries)) |
|
| 56 | 56 | { |
| 57 | 57 | $options['retry_attempts'] = $this->retries; |
| 58 | 58 | } |
@@ -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 | } |