| @@ -64,8 +64,8 @@ discard block | ||
| 64 | 64 |          foreach ($this->signals as $sig) { | 
| 65 | 65 | $this->pcntl->signal( | 
| 66 | 66 | $sig, | 
| 67 | -                function ($sig)  { | |
| 68 | -                    $this->log->info('received signal. signo: ' . $sig); | |
| 67 | +                function($sig) { | |
| 68 | +                    $this->log->info('received signal. signo: '.$sig); | |
| 69 | 69 | $this->setReceivedSignal($sig); | 
| 70 | 70 | |
| 71 | 71 |                      $this->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->container->queuedCount()); | |
| 118 | +        $this->log->info('queued task #'.$this->container->queuedCount()); | |
| 119 | 119 | } | 
| 120 | 120 | |
| 121 | 121 | /** | 
| @@ -158,7 +158,7 @@ discard block | ||
| 158 | 158 | $this->wait(); | 
| 159 | 159 | } | 
| 160 | 160 |          if ($tag !== null && !$this->container->hasTag($tag)) { | 
| 161 | -            throw new \InvalidArgumentException('unknown tag: ' . $tag); | |
| 161 | +            throw new \InvalidArgumentException('unknown tag: '.$tag); | |
| 162 | 162 | } | 
| 163 | 163 | |
| 164 | 164 | return $this->container->getCollection($tag); | 
| @@ -146,7 +146,7 @@ discard block | ||
| 146 | 146 | |
| 147 | 147 |          if (getmypid() === $this->ownerPid) { | 
| 148 | 148 | // owner | 
| 149 | -            $this->log->info('pid: ' . getmypid()); | |
| 149 | +            $this->log->info('pid: '.getmypid()); | |
| 150 | 150 | $this->taskQueue = $this->queueFactory->createTaskQueue(); | 
| 151 | 151 | $this->resultQueue = $this->queueFactory->createResultQueue(); | 
| 152 | 152 | |
| @@ -154,18 +154,18 @@ discard block | ||
| 154 | 154 |          } else { | 
| 155 | 155 | // master | 
| 156 | 156 | $activeWorkerSet = new ActiveWorkerSet(); | 
| 157 | -            $this->log->info('pid: ' . $this->masterPid); | |
| 157 | +            $this->log->info('pid: '.$this->masterPid); | |
| 158 | 158 | |
| 159 | 159 | $receivedSignal = &$this->receivedSignal; | 
| 160 | 160 |              foreach ($this->signals as $sig) { | 
| 161 | -                $this->pcntl->signal($sig, function ($sig) use ($activeWorkerSet, $receivedSignal) { | |
| 161 | +                $this->pcntl->signal($sig, function($sig) use ($activeWorkerSet, $receivedSignal) { | |
| 162 | 162 | $receivedSignal = $sig; | 
| 163 | -                    $this->log->info('received signal: ' . $sig); | |
| 163 | +                    $this->log->info('received signal: '.$sig); | |
| 164 | 164 | |
| 165 | 165 |                      if ($activeWorkerSet->count() === 0) { | 
| 166 | 166 |                          $this->log->info('no worker is active.'); | 
| 167 | 167 |                      } else { | 
| 168 | -                        $this->log->info('------> sending signal to workers. signal: ' . $sig); | |
| 168 | +                        $this->log->info('------> sending signal to workers. signal: '.$sig); | |
| 169 | 169 | $activeWorkerSet->terminate($sig); | 
| 170 | 170 |                          $this->log->info('<------ sent signal'); | 
| 171 | 171 | } | 
| @@ -173,7 +173,7 @@ discard block | ||
| 173 | 173 | }); | 
| 174 | 174 | } | 
| 175 | 175 | |
| 176 | -            $concurrency = (int)$this->config->get('concurrency'); | |
| 176 | +            $concurrency = (int) $this->config->get('concurrency'); | |
| 177 | 177 |              for ($i = 0; $i < $concurrency; $i++) { | 
| 178 | 178 | $activeWorkerSet->add($this->forkWorker()); | 
| 179 | 179 | } | 
| @@ -210,17 +210,17 @@ discard block | ||
| 210 | 210 | |
| 211 | 211 |          if (getmypid() === $this->masterPid) { | 
| 212 | 212 | // master | 
| 213 | -            $this->log->info('forked worker. pid: ' . $worker->getPid()); | |
| 213 | +            $this->log->info('forked worker. pid: '.$worker->getPid()); | |
| 214 | 214 | return $worker; | 
| 215 | 215 |          } else { | 
| 216 | 216 | // worker | 
| 217 | 217 | // @codeCoverageIgnoreStart | 
| 218 | -            $this->log->info('has forked. pid: ' . getmypid()); | |
| 218 | +            $this->log->info('has forked. pid: '.getmypid()); | |
| 219 | 219 | |
| 220 | 220 | // for php5.3 | 
| 221 | 221 | $receivedSignal = &$this->receivedSignal; | 
| 222 | 222 |              foreach ($this->signals as $sig) { | 
| 223 | -                $this->pcntl->signal($sig, function ($sig) use ($receivedSignal) { | |
| 223 | +                $this->pcntl->signal($sig, function($sig) use ($receivedSignal) { | |
| 224 | 224 | $receivedSignal = $sig; | 
| 225 | 225 | exit; | 
| 226 | 226 | }, false); | 
| @@ -229,7 +229,7 @@ discard block | ||
| 229 | 229 | $worker->setTaskQueue($this->queueFactory->createTaskQueue()); | 
| 230 | 230 | $worker->setResultQueue($this->queueFactory->createResultQueue()); | 
| 231 | 231 | |
| 232 | -            register_shutdown_function(function () use ($worker, $receivedSignal) { | |
| 232 | +            register_shutdown_function(function() use ($worker, $receivedSignal) { | |
| 233 | 233 |                  if ($worker->isFailedToEnqueueResult() && $receivedSignal === null) { | 
| 234 | 234 | $worker->error(); | 
| 235 | 235 | } | 
| @@ -265,14 +265,14 @@ discard block | ||
| 265 | 265 | */ | 
| 266 | 266 | public function sendSignalToMaster($sig = SIGTERM) | 
| 267 | 267 |      { | 
| 268 | -        $this->log->info('----> sending signal to master. signal: ' . $sig); | |
| 268 | +        $this->log->info('----> sending signal to master. signal: '.$sig); | |
| 269 | 269 | posix_kill($this->masterPid, $sig); | 
| 270 | 270 |          $this->log->info('<---- sent signal.'); | 
| 271 | 271 | |
| 272 | 272 |          $this->log->info('----> waiting for master shutdown.'); | 
| 273 | 273 | $status = null; | 
| 274 | 274 | $this->pcntl->waitpid($this->masterPid, $status); | 
| 275 | -        $this->log->info('<---- master shutdown. status: ' . $status); | |
| 275 | +        $this->log->info('<---- master shutdown. status: '.$status); | |
| 276 | 276 | $this->masterPid = null; | 
| 277 | 277 | } | 
| 278 | 278 | |
| @@ -42,7 +42,7 @@ | ||
| 42 | 42 | */ | 
| 43 | 43 | private function context() | 
| 44 | 44 |      { | 
| 45 | - $pid = getmypid(); | |
| 45 | + $pid = getmypid(); | |
| 46 | 46 |          switch ($pid) { | 
| 47 | 47 | case $this->ownerPid: | 
| 48 | 48 | $role = 'owner'; |