Completed
Push — master ( e5b054...7b4a69 )
by Akihito
02:22
created
src/Snidel.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
         foreach ($this->signals as $sig) {
82 82
             $this->pcntl->signal(
83 83
                 $sig,
84
-                function ($sig) use($log, $token, $self) {
85
-                    $log->info('received signal. signo: ' . $sig);
84
+                function($sig) use($log, $token, $self) {
85
+                    $log->info('received signal. signo: '.$sig);
86 86
                     $self->setReceivedSignal($sig);
87 87
 
88 88
                     $log->info('--> sending a signal to children.');
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             );
99 99
         }
100 100
 
101
-        $this->log->info('parent pid: ' . $this->ownerPid);
101
+        $this->log->info('parent pid: '.$this->ownerPid);
102 102
     }
103 103
 
104 104
     /**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             throw $e;
135 135
         }
136 136
 
137
-        $this->log->info('queued task #' . $this->forkContainer->queuedCount());
137
+        $this->log->info('queued task #'.$this->forkContainer->queuedCount());
138 138
     }
139 139
 
140 140
     /**
@@ -150,20 +150,20 @@  discard block
 block discarded – undo
150 150
 
151 151
         if ($pid) {
152 152
             // owner
153
-            $this->log->info('pid: ' . getmypid());
153
+            $this->log->info('pid: '.getmypid());
154 154
         } elseif ($pid === -1) {
155 155
             // error
156 156
         } else {
157 157
             // master
158 158
             $taskQueue = new TaskQueue($this->ownerPid);
159
-            $this->log->info('pid: ' . $this->masterProcessId);
159
+            $this->log->info('pid: '.$this->masterProcessId);
160 160
 
161 161
             foreach ($this->signals as $sig) {
162 162
                 $this->pcntl->signal($sig, SIG_DFL, true);
163 163
             }
164 164
 
165 165
             while ($task = $taskQueue->dequeue()) {
166
-                $this->log->info('dequeued task #' . $taskQueue->dequeuedCount());
166
+                $this->log->info('dequeued task #'.$taskQueue->dequeuedCount());
167 167
                 if ($this->token->accept()) {
168 168
                     $this->forkWorker($task);
169 169
                 }
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
 
193 193
         if (getmypid() === $this->masterProcessId) {
194 194
             // master
195
-            $this->log->info('forked worker. pid: ' . $fork->getPid());
195
+            $this->log->info('forked worker. pid: '.$fork->getPid());
196 196
         } else {
197 197
             // worker
198
-            $this->log->info('has forked. pid: ' . getmypid());
198
+            $this->log->info('has forked. pid: '.getmypid());
199 199
             // @codeCoverageIgnoreStart
200 200
 
201 201
             foreach ($this->signals as $sig) {
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             }
204 204
 
205 205
             $resultQueue = new ResultQueue($this->ownerPid);
206
-            register_shutdown_function(function () use ($fork, $resultQueue) {
206
+            register_shutdown_function(function() use ($fork, $resultQueue) {
207 207
                 if ($fork->hasNoResult() || !$fork->isQueued()) {
208 208
                     $result = new Result();
209 209
                     $result->setFailure();
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 
255 255
         if (getmypid() === $this->ownerPid) {
256 256
             // parent
257
-            $this->log->info('created child process. pid: ' . $fork->getPid());
257
+            $this->log->info('created child process. pid: '.$fork->getPid());
258 258
             $this->childPids[] = $fork->getPid();
259 259
         } else {
260 260
             // @codeCoverageIgnoreStart
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
             $dataRepository     = $this->dataRepository;
270 270
             $log                = $this->log;
271 271
             $processToken       = $this->processToken;
272
-            register_shutdown_function(function () use ($fork, $dataRepository, $log, $processToken) {
272
+            register_shutdown_function(function() use ($fork, $dataRepository, $log, $processToken) {
273 273
                 $data = $dataRepository->load(getmypid());
274 274
                 try {
275 275
                     $data->write($fork);
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         }
336 336
 
337 337
         if (!$this->forkContainer->hasTag($tag)) {
338
-            throw new \InvalidArgumentException('unknown tag: ' . $tag);
338
+            throw new \InvalidArgumentException('unknown tag: '.$tag);
339 339
         }
340 340
 
341 341
         return $this->forkContainer->getCollection($tag);
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
     public function sendSignalToChildren($sig)
351 351
     {
352 352
         foreach ($this->childPids as $pid) {
353
-            $this->log->info('----> sending a signal to child. pid: ' . $pid);
353
+            $this->log->info('----> sending a signal to child. pid: '.$pid);
354 354
             posix_kill($pid, $sig);
355 355
         }
356 356
     }
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 
453 453
             $childPid = $fork->getPid();
454 454
             if ($fork->hasNotFinishedSuccessfully()) {
455
-                $message = 'an error has occurred in child process. pid: ' . $childPid;
455
+                $message = 'an error has occurred in child process. pid: '.$childPid;
456 456
                 $this->log->error($message);
457 457
                 throw new \RuntimeException($message);
458 458
             }
Please login to merge, or discard this patch.