Passed
Push — develop ( 72b87b...66dbd5 )
by Портнов
05:21
created
src/Core/System/BeanstalkClient.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $config = $this->di->get('config')->beanstalk;
50 50
         $port   = $config->port;
51
-        if ( ! empty($this->port) && is_numeric($this->port)) {
51
+        if (!empty($this->port) && is_numeric($this->port)) {
52 52
             $port = $this->port;
53 53
         }
54 54
         $this->queue = Pheanstalk::create($config->host, $port);
55 55
         $this->queue->useTube($this->tube);
56
-        foreach ($this->subscriptions as $tube => $callback){
56
+        foreach ($this->subscriptions as $tube => $callback) {
57 57
             $this->subscribe($tube, $callback);
58 58
         }
59 59
         $this->connected = true;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 $this->queue->delete($job);
105 105
             }
106 106
         } catch (Throwable $exception) {
107
-            Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage());
107
+            Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage());
108 108
             if ($job !== null) {
109 109
                 $this->queue->bury($job);
110 110
             }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     ): Job {
137 137
         $tube = str_replace("\\", '-', $tube);
138 138
         // Change tube
139
-        if ( ! empty($tube) && $this->tube !== $tube) {
139
+        if (!empty($tube) && $this->tube !== $tube) {
140 140
             $this->queue->useTube($tube);
141 141
         }
142 142
         $job_data = serialize($job_data);
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
                 $queueStats = $this->queue->stats()->getArrayCopy();
162 162
 
163 163
                 // Delete buried jobs
164
-                $countBuried=$queueStats['current-jobs-buried'];
164
+                $countBuried = $queueStats['current-jobs-buried'];
165 165
                 while ($job = $this->queue->peekBuried()) {
166 166
                     $countBuried--;
167
-                    if ($countBuried<0){
167
+                    if ($countBuried < 0) {
168 168
                         break;
169 169
                     }
170 170
                     $id = $job->getId();
@@ -173,23 +173,23 @@  discard block
 block discarded – undo
173 173
                 }
174 174
 
175 175
                 // Delete outdated jobs
176
-                $countReady=$queueStats['current-jobs-ready'];
176
+                $countReady = $queueStats['current-jobs-ready'];
177 177
                 while ($job = $this->queue->peekReady()) {
178 178
                     $countReady--;
179
-                    if ($countReady<0){
179
+                    if ($countReady < 0) {
180 180
                         break;
181 181
                     }
182 182
                     $id = $job->getId();
183 183
                     $jobStats = $this->queue->statsJob($job)->getArrayCopy();
184
-                    $age                   = (int)$jobStats['age'];
185
-                    $expectedTimeToExecute = (int)$jobStats['ttr'] * 2;
184
+                    $age                   = (int) $jobStats['age'];
185
+                    $expectedTimeToExecute = (int) $jobStats['ttr'] * 2;
186 186
                     if ($age > $expectedTimeToExecute) {
187 187
                         $this->queue->delete($job);
188 188
                         Util::sysLogMsg(__METHOD__, "Deleted outdated job with ID {$id} from {$tube}");
189 189
                     }
190 190
                 }
191 191
             } catch (Throwable $exception) {
192
-                Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage());
192
+                Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage());
193 193
             }
194 194
         }
195 195
     }
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
         try {
223 223
             $job = $this->queue->reserveWithTimeout($timeout);
224 224
         } catch (Throwable $exception) {
225
-            Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage());
225
+            Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage());
226 226
         }
227 227
 
228 228
         if ($job === null) {
Please login to merge, or discard this patch.