Passed
Branch master (7d6942)
by Valentin
08:02
created
src/Command/CreateScheduleCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
         $this->workflow = $workflow;
52 52
         $this->schedule = $schedule;
53 53
         $this->onFailure = $onFailure ?? self::FAILURE_TYPE_CONTINUE;
54
-        $this->active = $active ?? true ;
54
+        $this->active = $active ?? true;
55 55
         $this->comment = $comment ?? $this->workflow->getComment();
56 56
     }
57 57
 
Please login to merge, or discard this patch.
src/Command/TubeExistsCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,6 +42,6 @@
 block discarded – undo
42 42
             return $tube->getName() === $name;
43 43
         });
44 44
 
45
-        return !$matchingTubes->isEmpty() ?  $matchingTubes->first() : false;
45
+        return !$matchingTubes->isEmpty() ? $matchingTubes->first() : false;
46 46
     }
47 47
 }
Please login to merge, or discard this patch.
src/Command/GetWorkflowInstancesDetailCommand.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,13 +72,13 @@
 block discarded – undo
72 72
 
73 73
         $subjobs = $responseData['workflow']['subjobs'];
74 74
         $jobInstances = new ArrayCollection([]);
75
-        foreach($subjobs as $subjob) {
75
+        foreach ($subjobs as $subjob) {
76 76
             $taskInstances = new ArrayCollection([]);
77
-            foreach($subjob['tasks'] as $tasks) {
77
+            foreach ($subjob['tasks'] as $tasks) {
78 78
                 $task = $tasks['@attributes'];
79 79
 
80 80
                 if (isset($task['execution_time'])) $task['execution_time'] = new \DateTime($task['execution_time']);
81
-                foreach($task as $key => $val)
81
+                foreach ($task as $key => $val)
82 82
                     if (ctype_digit($val)) $task[$key] = (int) $task[$key];
83 83
                 $taskInstances[] = new TaskInstance($task);
84 84
             }
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,8 +67,9 @@  discard block
 block discarded – undo
67 67
     public function parseResponse($responseLine, $responseData)
68 68
     {
69 69
 
70
-        if (!(isset($responseData['workflow'])))
71
-            return false;
70
+        if (!(isset($responseData['workflow']))) {
71
+                    return false;
72
+        }
72 73
 
73 74
         $subjobs = $responseData['workflow']['subjobs'];
74 75
         $jobInstances = new ArrayCollection([]);
@@ -77,9 +78,12 @@  discard block
 block discarded – undo
77 78
             foreach($subjob['tasks'] as $tasks) {
78 79
                 $task = $tasks['@attributes'];
79 80
 
80
-                if (isset($task['execution_time'])) $task['execution_time'] = new \DateTime($task['execution_time']);
81
-                foreach($task as $key => $val)
82
-                    if (ctype_digit($val)) $task[$key] = (int) $task[$key];
81
+                if (isset($task['execution_time'])) {
82
+                    $task['execution_time'] = new \DateTime($task['execution_time']);
83
+                }
84
+                foreach($task as $key => $val) {
85
+                                    if (ctype_digit($val)) $task[$key] = (int) $task[$key];
86
+                }
83 87
                 $taskInstances[] = new TaskInstance($task);
84 88
             }
85 89
             $jobInstances[] = new JobInstance($taskInstances);
Please login to merge, or discard this patch.
src/Command/PeekCommand.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
         $responseData = array_column($responseData, '@attributes');
74 74
         $dates = array_column($responseData, 'start_time');
75 75
         $mostRecent = [];
76
-        foreach($responseData as $date){
76
+        foreach ($responseData as $date) {
77 77
             $curDate = strtotime($date['start_time']);
78 78
             if (!isset($mostRecent['start_time']) || $curDate < strtotime($mostRecent['start_time'])) {
79 79
                 $mostRecent = $date;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,9 @@
 block discarded – undo
79 79
                 $mostRecent = $date;
80 80
             }
81 81
         }
82
-        if (empty($responseData)) return $this->parseResponse($responseLine, $responseData);
82
+        if (empty($responseData)) {
83
+            return $this->parseResponse($responseLine, $responseData);
84
+        }
83 85
         return $this->_createResponse(
84 86
             Response::RESPONSE_FOUND,
85 87
             array(
Please login to merge, or discard this patch.
src/Command/GetWorkflowCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@
 block discarded – undo
67 67
         $jobs = $workflow['workflow']['subjobs'];
68 68
         $workflow = $workflow['@attributes'] ?? $workflow;
69 69
         $jobObjects = [];
70
-        foreach($jobs as $job) {
70
+        foreach ($jobs as $job) {
71 71
             $taskObjects = [];
72
-            foreach($job['tasks'] as $task) {
72
+            foreach ($job['tasks'] as $task) {
73 73
                 $task = $task['@attributes'];
74 74
                 $taskObjects[] = new Task($task['path'], $task['queue'], $task['use-agent'], $task['user'], $task['host'], $task['output-method'], $task['parameters-mode']);
75 75
             }
Please login to merge, or discard this patch.
src/Command/WorkflowExistsCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,6 +42,6 @@
 block discarded – undo
42 42
             return $workflow->getName() === $name;
43 43
         });
44 44
 
45
-        return !$matchingWorkflows->isEmpty() ?  $matchingWorkflows->first() : false;
45
+        return !$matchingWorkflows->isEmpty() ? $matchingWorkflows->first() : false;
46 46
     }
47 47
 }
Please login to merge, or discard this patch.
src/Command/GetWorkflowInstancesCommand.php 2 patches
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -91,20 +91,19 @@
 block discarded – undo
91 91
         if (!(isset($responseData['workflow'])))
92 92
             return new ArrayCollection([]);
93 93
 
94
-        $instances = $responseData['workflow'] ;
94
+        $instances = $responseData['workflow'];
95 95
         $instances = isset($instances['tags']) ? [$instances['@attributes']] : $instances;
96 96
         $workflowInstances = new ArrayCollection([]);
97
-        foreach($instances as $instance) {
97
+        foreach ($instances as $instance) {
98 98
             $instance = $instance['@attributes'] ?? $instance;
99 99
             if (isset($instance['start_time'])) $instance['start_time'] = new \DateTime($instance['start_time']);
100 100
             if (isset($instance['end_time'])) $instance['end_time'] = new \DateTime($instance['end_time']);
101
-            foreach($instance as $key => $val)
101
+            foreach ($instance as $key => $val)
102 102
                 if (ctype_digit($val)) $instance[$key] = (int) $instance[$key];
103 103
             $workflowInstances[] = new WorkflowInstance($instance);
104 104
         }
105 105
         $collection['rows'] = (int) (isset($responseData['@attributes']['rows'])) ?
106
-            (int) $responseData['@attributes']['rows'] :
107
-            $workflowInstances->count();
106
+            (int) $responseData['@attributes']['rows'] : $workflowInstances->count();
108 107
         $collection['page'] = $this->page;
109 108
         $collection['workflow_instances'] = $workflowInstances;
110 109
         return new ArrayCollection($collection);
Please login to merge, or discard this patch.
Braces   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -76,8 +76,9 @@  discard block
 block discarded – undo
76 76
             'offset' => $offset,
77 77
             'limit' => $limit
78 78
         ];
79
-        if (!empty($this->workflow))
80
-            $filters['filter_workflow'] = $this->workflow->getName();
79
+        if (!empty($this->workflow)) {
80
+                    $filters['filter_workflow'] = $this->workflow->getName();
81
+        }
81 82
 
82 83
         return $filters;
83 84
     }
@@ -88,18 +89,24 @@  discard block
 block discarded – undo
88 89
     public function parseResponse($responseLine, $responseData)
89 90
     {
90 91
 
91
-        if (!(isset($responseData['workflow'])))
92
-            return new ArrayCollection([]);
92
+        if (!(isset($responseData['workflow']))) {
93
+                    return new ArrayCollection([]);
94
+        }
93 95
 
94 96
         $instances = $responseData['workflow'] ;
95 97
         $instances = isset($instances['tags']) ? [$instances['@attributes']] : $instances;
96 98
         $workflowInstances = new ArrayCollection([]);
97 99
         foreach($instances as $instance) {
98 100
             $instance = $instance['@attributes'] ?? $instance;
99
-            if (isset($instance['start_time'])) $instance['start_time'] = new \DateTime($instance['start_time']);
100
-            if (isset($instance['end_time'])) $instance['end_time'] = new \DateTime($instance['end_time']);
101
-            foreach($instance as $key => $val)
102
-                if (ctype_digit($val)) $instance[$key] = (int) $instance[$key];
101
+            if (isset($instance['start_time'])) {
102
+                $instance['start_time'] = new \DateTime($instance['start_time']);
103
+            }
104
+            if (isset($instance['end_time'])) {
105
+                $instance['end_time'] = new \DateTime($instance['end_time']);
106
+            }
107
+            foreach($instance as $key => $val) {
108
+                            if (ctype_digit($val)) $instance[$key] = (int) $instance[$key];
109
+            }
103 110
             $workflowInstances[] = new WorkflowInstance($instance);
104 111
         }
105 112
         $collection['rows'] = (int) (isset($responseData['@attributes']['rows'])) ?
Please login to merge, or discard this patch.
src/Command/ListTubesCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
     {
43 43
         $responseData = $responseData['queue'];
44 44
         $queues = [];
45
-        foreach($responseData as $queue ) {
45
+        foreach ($responseData as $queue) {
46 46
             $queue = $queue['@attributes'] ?? $queue;
47 47
             $queueObject = new Tube($queue['name'], $queue['concurrency']);
48 48
             $queueObject
Please login to merge, or discard this patch.
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.