@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | foreach ($this->signals as $sig) { |
| 65 | 65 | $this->pcntl->signal( |
| 66 | 66 | $sig, |
| 67 | - function ($sig) use($log, $self) { |
|
| 68 | - $log->info('received signal. signo: ' . $sig); |
|
| 67 | + function($sig) use($log, $self) { |
|
| 68 | + $log->info('received signal. signo: '.$sig); |
|
| 69 | 69 | $self->setReceivedSignal($sig); |
| 70 | 70 | |
| 71 | 71 | $log->info('--> sending a signal to children.'); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | ); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - $this->log->info('parent pid: ' . $this->ownerPid); |
|
| 80 | + $this->log->info('parent pid: '.$this->ownerPid); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | throw $e; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - $this->log->info('queued task #' . $this->forkContainer->queuedCount()); |
|
| 118 | + $this->log->info('queued task #'.$this->forkContainer->queuedCount()); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | if (getmypid() === $this->ownerPid) { |
| 144 | 144 | // parent |
| 145 | - $this->log->info('created child process. pid: ' . $fork->getPid()); |
|
| 145 | + $this->log->info('created child process. pid: '.$fork->getPid()); |
|
| 146 | 146 | } else { |
| 147 | 147 | // @codeCoverageIgnoreStart |
| 148 | 148 | // child |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | $log = $this->log; |
| 157 | 157 | $resultHasWritten = false; |
| 158 | - register_shutdown_function(function () use (&$resultHasWritten, $fork, $log, $token) { |
|
| 158 | + register_shutdown_function(function() use (&$resultHasWritten, $fork, $log, $token) { |
|
| 159 | 159 | if (!$resultHasWritten) { |
| 160 | 160 | $dataRepository = new DataRepository(); |
| 161 | 161 | $data = $dataRepository->load(getmypid()); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $this->wait(); |
| 236 | 236 | } |
| 237 | 237 | if ($tag !== null && !$this->forkContainer->hasTag($tag)) { |
| 238 | - throw new \InvalidArgumentException('unknown tag: ' . $tag); |
|
| 238 | + throw new \InvalidArgumentException('unknown tag: '.$tag); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | return $this->forkContainer->getCollection($tag); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | public function sendSignalToChildren($sig) |
| 251 | 251 | { |
| 252 | 252 | foreach ($this->forkContainer->getChildPids() as $pid) { |
| 253 | - $this->log->info('----> sending a signal to child. pid: ' . $pid); |
|
| 253 | + $this->log->info('----> sending a signal to child. pid: '.$pid); |
|
| 254 | 254 | posix_kill($pid, $sig); |
| 255 | 255 | } |
| 256 | 256 | } |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | $childPid = $result->getFork()->getPid(); |
| 353 | 353 | if ($result->getFork()->hasNotFinishedSuccessfully()) { |
| 354 | - $message = 'an error has occurred in child process. pid: ' . $childPid; |
|
| 354 | + $message = 'an error has occurred in child process. pid: '.$childPid; |
|
| 355 | 355 | $this->log->error($message); |
| 356 | 356 | throw new \RuntimeException($message); |
| 357 | 357 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | if ($pid) { |
| 142 | 142 | // owner |
| 143 | - $this->log->info('pid: ' . getmypid()); |
|
| 143 | + $this->log->info('pid: '.getmypid()); |
|
| 144 | 144 | |
| 145 | 145 | return $this->masterPid; |
| 146 | 146 | } elseif ($pid === -1) { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } else { |
| 149 | 149 | // master |
| 150 | 150 | $taskQueue = new TaskQueue($this->ownerPid); |
| 151 | - $this->log->info('pid: ' . $this->masterPid); |
|
| 151 | + $this->log->info('pid: '.$this->masterPid); |
|
| 152 | 152 | |
| 153 | 153 | foreach ($this->signals as $sig) { |
| 154 | 154 | $this->pcntl->signal($sig, SIG_DFL, true); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $workerCount = 0; |
| 157 | 157 | |
| 158 | 158 | while ($task = $taskQueue->dequeue()) { |
| 159 | - $this->log->info('dequeued task #' . $taskQueue->dequeuedCount()); |
|
| 159 | + $this->log->info('dequeued task #'.$taskQueue->dequeuedCount()); |
|
| 160 | 160 | if ($workerCount >= $this->concurrency) { |
| 161 | 161 | $status = null; |
| 162 | 162 | $this->pcntl->waitpid(-1, $status); |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | if (getmypid() === $this->masterPid) { |
| 189 | 189 | // master |
| 190 | - $this->log->info('forked worker. pid: ' . $fork->getPid()); |
|
| 190 | + $this->log->info('forked worker. pid: '.$fork->getPid()); |
|
| 191 | 191 | } else { |
| 192 | 192 | // worker |
| 193 | - $this->log->info('has forked. pid: ' . getmypid()); |
|
| 193 | + $this->log->info('has forked. pid: '.getmypid()); |
|
| 194 | 194 | // @codeCoverageIgnoreStart |
| 195 | 195 | |
| 196 | 196 | foreach ($this->signals as $sig) { |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $resultQueue = new ResultQueue($this->ownerPid); |
| 201 | 201 | $resultHasQueued = false; |
| 202 | - register_shutdown_function(function () use (&$resultHasQueued, $fork, $resultQueue) { |
|
| 202 | + register_shutdown_function(function() use (&$resultHasQueued, $fork, $resultQueue) { |
|
| 203 | 203 | if (!$resultHasQueued) { |
| 204 | 204 | $result = new Result(); |
| 205 | 205 | $result->setFailure(); |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | public function toArray() |
| 27 | 27 | { |
| 28 | 28 | return array_map( |
| 29 | - function ($result) { |
|
| 29 | + function($result) { |
|
| 30 | 30 | return $result->getReturn(); |
| 31 | 31 | }, |
| 32 | 32 | $this->results |