Completed
Branch master (b37978)
by Valentin
02:19
created
src/Pheanstalk.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,8 +113,9 @@
 block discarded – undo
113 113
     public function workflowExists($name)
114 114
     {
115 115
         $workflow = $this->_dispatch(new Command\WorkflowExistsCommand($name));
116
-        if ($workflow instanceof Workflow)
117
-            return $this->getCurrentClass()->getWorkflow($workflow);
116
+        if ($workflow instanceof Workflow) {
117
+                    return $this->getCurrentClass()->getWorkflow($workflow);
118
+        }
118 119
         return false;
119 120
     }
120 121
 
Please login to merge, or discard this patch.
src/Structure/Task.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Structure/WorkflowInstance.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,9 +73,9 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,18 +69,23 @@
 block discarded – undo
69 69
         $properties = $thisObject->getProperties();
70 70
             foreach ($properties as $property) {
71 71
                 $snakeProperty = $this->from_camel_case($property->getName());
72
-                if (isset($params[$snakeProperty]))
73
-                    $this->{$property->getName()} = $params[$snakeProperty];
72
+                if (isset($params[$snakeProperty])) {
73
+                                    $this->{$property->getName()} = $params[$snakeProperty];
74
+                }
74 75
             }
75 76
             if (!is_null($this->getRunningTasks()) && !is_null($this->getQueuedTasks())
76
-                && $this->getRunningTasks() - $this->getQueuedTasks() > 0 )
77
-                $this->setStatus(self::STATUS_RUNNING);
78
-            if (!is_null($this->getQueuedTasks()) && $this->getQueuedTasks() > 0 )
79
-                $this->setStatus(self::STATUS_QUEUED);
80
-            if (!is_null($this->getRetryingTasks()) && $this->getRetryingTasks() > 0)
81
-                $this->setStatus(self::STATUS_RETRYING);
82
-            if (!is_null($this->getErrors()) && $this->getErrors() > 0)
83
-                $this->setStatus(self::STATUS_FAILED);
77
+                && $this->getRunningTasks() - $this->getQueuedTasks() > 0 ) {
78
+                            $this->setStatus(self::STATUS_RUNNING);
79
+            }
80
+            if (!is_null($this->getQueuedTasks()) && $this->getQueuedTasks() > 0 ) {
81
+                            $this->setStatus(self::STATUS_QUEUED);
82
+            }
83
+            if (!is_null($this->getRetryingTasks()) && $this->getRetryingTasks() > 0) {
84
+                            $this->setStatus(self::STATUS_RETRYING);
85
+            }
86
+            if (!is_null($this->getErrors()) && $this->getErrors() > 0) {
87
+                            $this->setStatus(self::STATUS_FAILED);
88
+            }
84 89
     }
85 90
 
86 91
     /**
Please login to merge, or discard this patch.
src/Structure/Workflow.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Structure/Job.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
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));
Please login to merge, or discard this patch.
src/Structure/TaskInstance.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@
 block discarded – undo
39 39
         $properties = $thisObject->getProperties();
40 40
         foreach ($properties as $property) {
41 41
             $snakeProperty = $this->from_camel_case($property->getName());
42
-            if (isset($params[$snakeProperty]))
43
-                $this->{$property->getName()} = $params[$snakeProperty];
42
+            if (isset($params[$snakeProperty])) {
43
+                            $this->{$property->getName()} = $params[$snakeProperty];
44
+            }
44 45
         }
45 46
     }
46 47
 
Please login to merge, or discard this patch.
src/Structure/TimeSchedule.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -66,8 +66,9 @@  discard block
 block discarded – undo
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 )
70
-            throw new \Exception('Wrong units of time');
69
+        if (count( $seconds ) !== count( array_filter( $seconds, 'is_numeric' )) || array_sum($seconds) > self::SUM_SUBUNIT_IN_UNIT ) {
70
+                    throw new \Exception('Wrong units of time');
71
+        }
71 72
         $this->seconds = $seconds;
72 73
         return $this;
73 74
     }
@@ -87,8 +88,9 @@  discard block
 block discarded – undo
87 88
      */
88 89
     public function setMinutes(array $minutes): TimeSchedule
89 90
     {
90
-        if (count( $minutes ) !== count( array_filter( $minutes, 'is_numeric' )) || array_sum($minutes) > self::SUM_SUBUNIT_IN_UNIT )
91
-            throw new \Exception('Wrong units of time');
91
+        if (count( $minutes ) !== count( array_filter( $minutes, 'is_numeric' )) || array_sum($minutes) > self::SUM_SUBUNIT_IN_UNIT ) {
92
+                    throw new \Exception('Wrong units of time');
93
+        }
92 94
         $this->minutes = $minutes;
93 95
         return $this;
94 96
     }
@@ -108,8 +110,9 @@  discard block
 block discarded – undo
108 110
      */
109 111
     public function setHours(array $hours): TimeSchedule
110 112
     {
111
-        if (count( $hours ) !== count( array_filter( $hours, 'is_numeric' )) || array_sum($hours) > self::SUM_HOURS )
112
-            throw new \Exception('Wrong units of time');
113
+        if (count( $hours ) !== count( array_filter( $hours, 'is_numeric' )) || array_sum($hours) > self::SUM_HOURS ) {
114
+                    throw new \Exception('Wrong units of time');
115
+        }
113 116
         $this->hours = $hours;
114 117
         return $this;
115 118
     }
@@ -129,8 +132,9 @@  discard block
 block discarded – undo
129 132
      */
130 133
     public function setDays(array $days): TimeSchedule
131 134
     {
132
-        if (count( $days ) !== count( array_filter( $days, 'is_numeric' )) || array_sum($days) > self::SUM_DAYS )
133
-            throw new \Exception('Wrong units of time');
135
+        if (count( $days ) !== count( array_filter( $days, 'is_numeric' )) || array_sum($days) > self::SUM_DAYS ) {
136
+                    throw new \Exception('Wrong units of time');
137
+        }
134 138
         $this->days = $days;
135 139
         return $this;
136 140
     }
@@ -150,8 +154,9 @@  discard block
 block discarded – undo
150 154
      */
151 155
     public function setMonths(array $months): TimeSchedule
152 156
     {
153
-        if (count( $months ) !== count( array_filter( $months, 'is_numeric' )) || array_sum($months) > self::SUM_MONTHS )
154
-        throw new \Exception('Wrong units of time');
157
+        if (count( $months ) !== count( array_filter( $months, 'is_numeric' )) || array_sum($months) > self::SUM_MONTHS ) {
158
+                throw new \Exception('Wrong units of time');
159
+        }
155 160
         $this->months = $months;
156 161
         return $this;
157 162
     }
Please login to merge, or discard this patch.
src/Structure/Tube.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -100,10 +100,11 @@
 block discarded – undo
100 100
     public function setDynamic($dynamic): Tube
101 101
     {
102 102
         if (!is_bool($dynamic)) {
103
-            if($dynamic === self::IS_NOT_DYNAMIC)
104
-                $dynamic = false;
105
-            else
106
-                $dynamic = true;
103
+            if($dynamic === self::IS_NOT_DYNAMIC) {
104
+                            $dynamic = false;
105
+            } else {
106
+                            $dynamic = true;
107
+            }
107 108
         }
108 109
         $this->dynamic = $dynamic;
109 110
         return $this;
Please login to merge, or discard this patch.
src/Connection.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -195,8 +195,9 @@
 block discarded – undo
195 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)
199
-            $root->setAttribute('action', $action);
198
+        if($action) {
199
+                    $root->setAttribute('action', $action);
200
+        }
200 201
         foreach ($attributes as $key => $value) {
201 202
             $root->setAttribute($key, $value);
202 203
         }
Please login to merge, or discard this patch.