@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | $status = empty($status) ? GetWorkflowInstancesDetailCommand::FILTERS : [$status]; |
| 135 | 135 | $instances = new ArrayCollection([]); |
| 136 | - foreach($status as $stat) { |
|
| 136 | + foreach ($status as $stat) { |
|
| 137 | 137 | $instances[strtolower($stat)] = $this->_dispatch(new Command\GetWorkflowInstancesCommand($workflow, $stat)); |
| 138 | 138 | // if ($stat === GetWorkflowInstancesCommand::FILTER_EXECUTING) { |
| 139 | 139 | /** @var ArrayCollection $workflowCollection */ |
| 140 | 140 | $workflowCollection = $instances[strtolower($stat)]->get('workflow_instances'); |
| 141 | 141 | if (!empty($workflowCollection)) { |
| 142 | - foreach($workflowCollection as $instance) { |
|
| 142 | + foreach ($workflowCollection as $instance) { |
|
| 143 | 143 | $this->getCurrentClass()->getWorkflowInstancesDetails($instance); |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -238,22 +238,22 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function create(Workflow $workflow, $force = false): Workflow |
| 240 | 240 | { |
| 241 | - try{ |
|
| 241 | + try { |
|
| 242 | 242 | $tubes = []; |
| 243 | 243 | /** @var Job $job */ |
| 244 | - foreach($workflow->getJobs() as $job) { |
|
| 244 | + foreach ($workflow->getJobs() as $job) { |
|
| 245 | 245 | /** @var Task $task */ |
| 246 | 246 | foreach ($job->getTasks() as $task) { |
| 247 | 247 | $tubes = array_merge($tubes, [$task->getQueue()]); |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | - foreach($tubes as $tube) { |
|
| 250 | + foreach ($tubes as $tube) { |
|
| 251 | 251 | if (!$this->getCurrentClass()->tubeExists($tube)) { |
| 252 | 252 | $this->getCurrentClass()->createTube(new Tube($tube, 1)); |
| 253 | 253 | }; |
| 254 | 254 | } |
| 255 | 255 | $workflow = $this->_dispatch(new Command\CreateCommand($workflow)); |
| 256 | - } catch(ServerDuplicateEntryException $e) { |
|
| 256 | + } catch (ServerDuplicateEntryException $e) { |
|
| 257 | 257 | if ($force) { |
| 258 | 258 | $workflows = $this->_dispatch(new Command\ListWorkflowsCommand()); |
| 259 | 259 | $workflowToDelete = $workflows->filter(function(Workflow $listedWorkflow) use ($workflow) { |
@@ -199,7 +199,7 @@ |
||
| 199 | 199 | $reflection = new \ReflectionClass($this); |
| 200 | 200 | $dom = new \DOMDocument("1.0", "utf-8"); |
| 201 | 201 | $root = $dom->createElement("task"); |
| 202 | - foreach($reflection->getProperties() as $property) |
|
| 202 | + foreach ($reflection->getProperties() as $property) |
|
| 203 | 203 | { |
| 204 | 204 | $value = $this->{'get' . ucfirst($property->getName())}(); |
| 205 | 205 | $root->setAttribute($this->from_camel_case($property->getName()), $value); |
@@ -73,9 +73,9 @@ |
||
| 73 | 73 | $this->{$property->getName()} = $params[$snakeProperty]; |
| 74 | 74 | } |
| 75 | 75 | if (!is_null($this->getRunningTasks()) && !is_null($this->getQueuedTasks()) |
| 76 | - && $this->getRunningTasks() - $this->getQueuedTasks() > 0 ) |
|
| 76 | + && $this->getRunningTasks() - $this->getQueuedTasks() > 0) |
|
| 77 | 77 | $this->setStatus(self::STATUS_RUNNING); |
| 78 | - if (!is_null($this->getQueuedTasks()) && $this->getQueuedTasks() > 0 ) |
|
| 78 | + if (!is_null($this->getQueuedTasks()) && $this->getQueuedTasks() > 0) |
|
| 79 | 79 | $this->setStatus(self::STATUS_QUEUED); |
| 80 | 80 | if (!is_null($this->getRetryingTasks()) && $this->getRetryingTasks() > 0) |
| 81 | 81 | $this->setStatus(self::STATUS_RETRYING); |
@@ -234,7 +234,7 @@ |
||
| 234 | 234 | $root = $dom->createElement("workflow"); |
| 235 | 235 | $subjobs = $dom->createElement("subjobs"); |
| 236 | 236 | /** @var Job $job*/ |
| 237 | - foreach($this->getJobs() as $job) { |
|
| 237 | + foreach ($this->getJobs() as $job) { |
|
| 238 | 238 | $jobNode = $job->getXml()->getElementsByTagName('job')->item(0); |
| 239 | 239 | $subjobs->appendChild($dom->importNode($jobNode, true)); |
| 240 | 240 | |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | $root = $dom->createElement("job"); |
| 74 | 74 | $tasks = $dom->createElement("tasks"); |
| 75 | 75 | /** @var Task $task */ |
| 76 | - foreach($this->getTasks() as $task) { |
|
| 76 | + foreach ($this->getTasks() as $task) { |
|
| 77 | 77 | $taskItem = $dom->createElement("task"); |
| 78 | 78 | $taskNode = $task->getXml()->getElementsByTagName('task')->item(0); |
| 79 | 79 | $tasks->appendChild($dom->importNode($taskNode, true)); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function setSeconds(array $seconds): TimeSchedule |
| 68 | 68 | { |
| 69 | - if (count( $seconds ) !== count( array_filter( $seconds, 'is_numeric' )) || array_sum($seconds) > self::SUM_SUBUNIT_IN_UNIT ) |
|
| 69 | + if (count($seconds) !== count(array_filter($seconds, 'is_numeric')) || array_sum($seconds) > self::SUM_SUBUNIT_IN_UNIT) |
|
| 70 | 70 | throw new \Exception('Wrong units of time'); |
| 71 | 71 | $this->seconds = $seconds; |
| 72 | 72 | return $this; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function setMinutes(array $minutes): TimeSchedule |
| 89 | 89 | { |
| 90 | - if (count( $minutes ) !== count( array_filter( $minutes, 'is_numeric' )) || array_sum($minutes) > self::SUM_SUBUNIT_IN_UNIT ) |
|
| 90 | + if (count($minutes) !== count(array_filter($minutes, 'is_numeric')) || array_sum($minutes) > self::SUM_SUBUNIT_IN_UNIT) |
|
| 91 | 91 | throw new \Exception('Wrong units of time'); |
| 92 | 92 | $this->minutes = $minutes; |
| 93 | 93 | return $this; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function setHours(array $hours): TimeSchedule |
| 110 | 110 | { |
| 111 | - if (count( $hours ) !== count( array_filter( $hours, 'is_numeric' )) || array_sum($hours) > self::SUM_HOURS ) |
|
| 111 | + if (count($hours) !== count(array_filter($hours, 'is_numeric')) || array_sum($hours) > self::SUM_HOURS) |
|
| 112 | 112 | throw new \Exception('Wrong units of time'); |
| 113 | 113 | $this->hours = $hours; |
| 114 | 114 | return $this; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function setDays(array $days): TimeSchedule |
| 131 | 131 | { |
| 132 | - if (count( $days ) !== count( array_filter( $days, 'is_numeric' )) || array_sum($days) > self::SUM_DAYS ) |
|
| 132 | + if (count($days) !== count(array_filter($days, 'is_numeric')) || array_sum($days) > self::SUM_DAYS) |
|
| 133 | 133 | throw new \Exception('Wrong units of time'); |
| 134 | 134 | $this->days = $days; |
| 135 | 135 | return $this; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function setMonths(array $months): TimeSchedule |
| 152 | 152 | { |
| 153 | - if (count( $months ) !== count( array_filter( $months, 'is_numeric' )) || array_sum($months) > self::SUM_MONTHS ) |
|
| 153 | + if (count($months) !== count(array_filter($months, 'is_numeric')) || array_sum($months) > self::SUM_MONTHS) |
|
| 154 | 154 | throw new \Exception('Wrong units of time'); |
| 155 | 155 | $this->months = $months; |
| 156 | 156 | return $this; |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | public function setDynamic($dynamic): Tube |
| 101 | 101 | { |
| 102 | 102 | if (!is_bool($dynamic)) { |
| 103 | - if($dynamic === self::IS_NOT_DYNAMIC) |
|
| 103 | + if ($dynamic === self::IS_NOT_DYNAMIC) |
|
| 104 | 104 | $dynamic = false; |
| 105 | 105 | else |
| 106 | 106 | $dynamic = true; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | $xml = new \SimpleXMLElement($responseLine); |
| 107 | 107 | $json = json_encode($xml); |
| 108 | - $responseLine = json_decode($json,TRUE); |
|
| 108 | + $responseLine = json_decode($json, TRUE); |
|
| 109 | 109 | $responseName = preg_replace('#^(\S+).*$#s', '$1', $responseLine["@attributes"]['status']); |
| 110 | 110 | if ($responseName === "KO") { |
| 111 | 111 | $exceptionType = $responseLine['@attributes']['error-code'] ?? Response::RESPONSE_SERVER_ERROR; |
@@ -192,10 +192,10 @@ discard block |
||
| 192 | 192 | return $this->_socket; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - protected function build_query($name, $action = false, $attributes = [], $parameters = []){ |
|
| 195 | + protected function build_query($name, $action = false, $attributes = [], $parameters = []) { |
|
| 196 | 196 | $dom = new \DOMDocument("1.0", "utf-8"); |
| 197 | 197 | $root = $dom->createElement($name); |
| 198 | - if($action) |
|
| 198 | + if ($action) |
|
| 199 | 199 | $root->setAttribute('action', $action); |
| 200 | 200 | foreach ($attributes as $key => $value) { |
| 201 | 201 | $root->setAttribute($key, $value); |