@@ -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)); |
@@ -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; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public function recv() |
102 | 102 | { |
103 | 103 | $response = ""; |
104 | - while($recv = $this->_wrapper()->fread($this->_socket, 1600)){ |
|
104 | + while ($recv = $this->_wrapper()->fread($this->_socket, 1600)) { |
|
105 | 105 | $response .= $recv; |
106 | 106 | } |
107 | 107 | return $response; |
@@ -123,14 +123,13 @@ discard block |
||
123 | 123 | do { |
124 | 124 | libxml_clear_errors(); |
125 | 125 | $data .= isset($length) ? |
126 | - $this->_wrapper()->fgets($this->_socket, $length) : |
|
127 | - $this->_wrapper()->fgets($this->_socket); |
|
126 | + $this->_wrapper()->fgets($this->_socket, $length) : $this->_wrapper()->fgets($this->_socket); |
|
128 | 127 | simplexml_load_string($data); |
129 | 128 | if (!empty(libxml_get_errors()) && microtime(true) - $timer > $timeout) { |
130 | 129 | $this->disconnect(); |
131 | 130 | throw new Exception\SocketException('Socket timed out!'); |
132 | - } elseif(empty(libxml_get_errors())) { |
|
133 | - try{ |
|
131 | + } elseif (empty(libxml_get_errors())) { |
|
132 | + try { |
|
134 | 133 | $xml = new \SimpleXMLElement($data); |
135 | 134 | } catch (\Exception $e) { |
136 | 135 | $error = (string) (isset($xml['error'])) ? $xml['error'] : 'Socket closed by server!'; |
@@ -199,9 +199,9 @@ |
||
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 | - $value = $this->{'get' . ucfirst($property->getName())}(); |
|
204 | + $value = $this->{'get'.ucfirst($property->getName())}(); |
|
205 | 205 | $root->setAttribute($this->from_camel_case($property->getName()), $value); |
206 | 206 | } |
207 | 207 | $dom->appendChild($root); |
@@ -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; |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | |
178 | 178 | public function __toString() |
179 | 179 | { |
180 | - return implode(",", $this->getSeconds()) . ";" . |
|
181 | - implode(",", $this->getMinutes()) . ";" . |
|
182 | - implode(",", $this->getHours()) . ";" . |
|
183 | - implode(",", $this->getDays()) . ";" . |
|
184 | - implode(",", $this->getMonths()) . ";" . |
|
180 | + return implode(",", $this->getSeconds()).";". |
|
181 | + implode(",", $this->getMinutes()).";". |
|
182 | + implode(",", $this->getHours()).";". |
|
183 | + implode(",", $this->getDays()).";". |
|
184 | + implode(",", $this->getMonths()).";". |
|
185 | 185 | implode(",", $this->getWeekdays()) |
186 | 186 | ; |
187 | 187 |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | $socket->write($xml); |
101 | 101 | |
102 | 102 | $responseLine = $socket->getLine(); |
103 | - if ($command->getGroup() . ':' . $command->getAction() === 'instance:query') { |
|
103 | + if ($command->getGroup().':'.$command->getAction() === 'instance:query') { |
|
104 | 104 | // dump($responseLine, $command->getGroup() . ':' . $command->getAction()); |
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); |