@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | foreach ($this->signals as $sig) { |
| 96 | 96 | $this->pcntl->signal( |
| 97 | 97 | $sig, |
| 98 | - function ($sig) use($log, $token, $self) { |
|
| 99 | - $log->info('received signal. signo: ' . $sig); |
|
| 98 | + function($sig) use($log, $token, $self) { |
|
| 99 | + $log->info('received signal. signo: '.$sig); |
|
| 100 | 100 | $self->setReceivedSignal($sig); |
| 101 | 101 | |
| 102 | 102 | $log->info('--> sending a signal to children.'); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | ); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $this->log->info('parent pid: ' . $this->ownerPid); |
|
| 115 | + $this->log->info('parent pid: '.$this->ownerPid); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | throw $e; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - $this->log->info('queued task #' . $this->taskQueue->queuedCount()); |
|
| 151 | + $this->log->info('queued task #'.$this->taskQueue->queuedCount()); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -164,17 +164,17 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | if ($pid) { |
| 166 | 166 | // owner |
| 167 | - $this->log->info('pid: ' . getmypid()); |
|
| 167 | + $this->log->info('pid: '.getmypid()); |
|
| 168 | 168 | } elseif ($pid === -1) { |
| 169 | 169 | // error |
| 170 | 170 | } else { |
| 171 | 171 | // master |
| 172 | - $this->log->info('pid: ' . $this->masterProcessId); |
|
| 172 | + $this->log->info('pid: '.$this->masterProcessId); |
|
| 173 | 173 | foreach ($this->signals as $sig) { |
| 174 | 174 | $this->pcntl->signal($sig, SIG_DFL, true); |
| 175 | 175 | } |
| 176 | 176 | while ($task = $this->taskQueue->dequeue()) { |
| 177 | - $this->log->info('dequeued task #' . $this->taskQueue->dequeuedCount()); |
|
| 177 | + $this->log->info('dequeued task #'.$this->taskQueue->dequeuedCount()); |
|
| 178 | 178 | if ($this->token->accept()) { |
| 179 | 179 | $this->forkWorker($task); |
| 180 | 180 | } |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | if (getmypid() === $this->masterProcessId) { |
| 205 | 205 | // master |
| 206 | - $this->log->info('forked worker. pid: ' . $fork->getPid()); |
|
| 206 | + $this->log->info('forked worker. pid: '.$fork->getPid()); |
|
| 207 | 207 | } else { |
| 208 | 208 | // worker |
| 209 | - $this->log->info('has forked. pid: ' . getmypid()); |
|
| 209 | + $this->log->info('has forked. pid: '.getmypid()); |
|
| 210 | 210 | // @codeCoverageIgnoreStart |
| 211 | 211 | foreach ($this->signals as $sig) { |
| 212 | 212 | $this->pcntl->signal($sig, SIG_DFL, true); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | // in php5.3, $this is not usable directly with closures. |
| 216 | 216 | $resultQueue = $this->resultQueue; |
| 217 | - register_shutdown_function(function () use ($fork, $resultQueue) { |
|
| 217 | + register_shutdown_function(function() use ($fork, $resultQueue) { |
|
| 218 | 218 | if ($fork->hasNoResult() || !$fork->isQueued()) { |
| 219 | 219 | $result = new Result(); |
| 220 | 220 | $result->setFailure(); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | if (getmypid() === $this->ownerPid) { |
| 266 | 266 | // parent |
| 267 | - $this->log->info('created child process. pid: ' . $fork->getPid()); |
|
| 267 | + $this->log->info('created child process. pid: '.$fork->getPid()); |
|
| 268 | 268 | $this->childPids[] = $fork->getPid(); |
| 269 | 269 | } else { |
| 270 | 270 | // @codeCoverageIgnoreStart |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $dataRepository = $this->dataRepository; |
| 280 | 280 | $log = $this->log; |
| 281 | 281 | $processToken = $this->processToken; |
| 282 | - register_shutdown_function(function () use ($fork, $dataRepository, $log, $processToken) { |
|
| 282 | + register_shutdown_function(function() use ($fork, $dataRepository, $log, $processToken) { |
|
| 283 | 283 | $data = $dataRepository->load(getmypid()); |
| 284 | 284 | try { |
| 285 | 285 | $data->write($fork->getResult()); |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | $childPid = $fork->getPid(); |
| 329 | 329 | $result = $fork->getResult(); |
| 330 | 330 | if ($fork->hasNotFinishedSuccessfully()) { |
| 331 | - $message = 'an error has occurred in child process. pid: ' . $childPid; |
|
| 331 | + $message = 'an error has occurred in child process. pid: '.$childPid; |
|
| 332 | 332 | $this->log->error($message); |
| 333 | 333 | $this->error[$childPid] = array( |
| 334 | 334 | 'status' => $fork->getStatus(), |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | if (!$this->forkContainer->hasTag($tag)) { |
| 398 | - throw new \InvalidArgumentException('unknown tag: ' . $tag); |
|
| 398 | + throw new \InvalidArgumentException('unknown tag: '.$tag); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | return $this->forkContainer->getCollection($tag); |
@@ -422,12 +422,12 @@ discard block |
||
| 422 | 422 | return new ForkCollection($this->forks); |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - $filtered = array_filter($this->forks, function ($fork) use ($tag) { |
|
| 425 | + $filtered = array_filter($this->forks, function($fork) use ($tag) { |
|
| 426 | 426 | return $fork->getTag() === $tag; |
| 427 | 427 | }); |
| 428 | 428 | |
| 429 | 429 | if (count($filtered) === 0) { |
| 430 | - throw new \InvalidArgumentException('unknown tag: ' . $tag); |
|
| 430 | + throw new \InvalidArgumentException('unknown tag: '.$tag); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | return new ForkCollection($filtered); |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | public function sendSignalToChildren($sig) |
| 443 | 443 | { |
| 444 | 444 | foreach ($this->childPids as $pid) { |
| 445 | - $this->log->info('----> sending a signal to child. pid: ' . $pid); |
|
| 445 | + $this->log->info('----> sending a signal to child. pid: '.$pid); |
|
| 446 | 446 | posix_kill($pid, $sig); |
| 447 | 447 | } |
| 448 | 448 | } |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | $childPid = $fork->getPid(); |
| 546 | 546 | if ($fork->hasNotFinishedSuccessfully()) { |
| 547 | - $message = 'an error has occurred in child process. pid: ' . $childPid; |
|
| 547 | + $message = 'an error has occurred in child process. pid: '.$childPid; |
|
| 548 | 548 | $this->log->error($message); |
| 549 | 549 | throw new \RuntimeException($message); |
| 550 | 550 | } |