@@ -11,6 +11,9 @@ |
||
| 11 | 11 | private $queuedCount = 0; |
| 12 | 12 | private $dequeuedCount = 0; |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param integer $ownerPid |
|
| 16 | + */ |
|
| 14 | 17 | public function __construct($ownerPid) |
| 15 | 18 | { |
| 16 | 19 | $this->ownerPid = $ownerPid; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | /** |
| 17 | 17 | * @param callable $callable |
| 18 | 18 | * @param array $args |
| 19 | - * @param string $string |
|
| 19 | + * @param string|null $tag |
|
| 20 | 20 | */ |
| 21 | 21 | public function __construct($callable, $args, $tag) |
| 22 | 22 | { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * @return string|null |
|
| 63 | + * @return string |
|
| 64 | 64 | */ |
| 65 | 65 | public function getTag() |
| 66 | 66 | { |
@@ -45,6 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * @param int $ownerPid |
| 48 | + * @param Log $log |
|
| 48 | 49 | */ |
| 49 | 50 | public function __construct($ownerPid, $log, $concurrency = 5) |
| 50 | 51 | { |
@@ -60,6 +61,7 @@ discard block |
||
| 60 | 61 | |
| 61 | 62 | /** |
| 62 | 63 | * @param \Ackintosh\Snidel\Task |
| 64 | + * @param Task $task |
|
| 63 | 65 | * @return void |
| 64 | 66 | */ |
| 65 | 67 | public function enqueue($task) |
@@ -155,6 +157,7 @@ discard block |
||
| 155 | 157 | * fork worker process |
| 156 | 158 | * |
| 157 | 159 | * @param \Ackintosh\Snidel\Task |
| 160 | + * @param Task $task |
|
| 158 | 161 | * @return void |
| 159 | 162 | * @throws \RuntimeException |
| 160 | 163 | */ |
@@ -262,7 +265,7 @@ discard block |
||
| 262 | 265 | } |
| 263 | 266 | |
| 264 | 267 | /** |
| 265 | - * @return array |
|
| 268 | + * @return integer[] |
|
| 266 | 269 | */ |
| 267 | 270 | public function getChildPids() |
| 268 | 271 | { |
@@ -280,6 +283,9 @@ discard block |
||
| 280 | 283 | return $this->forks[$pid]; |
| 281 | 284 | } |
| 282 | 285 | |
| 286 | + /** |
|
| 287 | + * @param string $tag |
|
| 288 | + */ |
|
| 283 | 289 | public function getCollection($tag = null) |
| 284 | 290 | { |
| 285 | 291 | if ($tag === null) { |
@@ -293,7 +299,7 @@ discard block |
||
| 293 | 299 | * return forks |
| 294 | 300 | * |
| 295 | 301 | * @param string $tag |
| 296 | - * @return \Ackintosh\Snidel\Fork[] |
|
| 302 | + * @return ForkCollection |
|
| 297 | 303 | */ |
| 298 | 304 | private function getCollectionWithTag($tag) |
| 299 | 305 | { |
@@ -313,7 +319,7 @@ discard block |
||
| 313 | 319 | } |
| 314 | 320 | |
| 315 | 321 | /** |
| 316 | - * @return \Ackintosh\Sniden\Error |
|
| 322 | + * @return Error |
|
| 317 | 323 | */ |
| 318 | 324 | public function getError() |
| 319 | 325 | { |
@@ -12,6 +12,9 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | private $dequeuedCount = 0; |
| 14 | 14 | |
| 15 | + /** |
|
| 16 | + * @param integer $ownerPid |
|
| 17 | + */ |
|
| 15 | 18 | public function __construct($ownerPid) |
| 16 | 19 | { |
| 17 | 20 | $this->ownerPid = $ownerPid; |
@@ -21,6 +24,7 @@ discard block |
||
| 21 | 24 | |
| 22 | 25 | /** |
| 23 | 26 | * @param \Ackintosh\Snidel\Fork |
| 27 | + * @param Fork $fork |
|
| 24 | 28 | */ |
| 25 | 29 | public function enqueue($fork) |
| 26 | 30 | { |
@@ -50,15 +50,15 @@ |
||
| 50 | 50 | } |
| 51 | 51 | $pid = getmypid(); |
| 52 | 52 | switch (true) { |
| 53 | - case $this->ownerPid === $pid: |
|
| 54 | - $role = 'owner'; |
|
| 55 | - break; |
|
| 56 | - case $this->masterPid === $pid: |
|
| 57 | - $role = 'master'; |
|
| 58 | - break; |
|
| 59 | - default: |
|
| 60 | - $role = 'worker'; |
|
| 61 | - break; |
|
| 53 | + case $this->ownerPid === $pid: |
|
| 54 | + $role = 'owner'; |
|
| 55 | + break; |
|
| 56 | + case $this->masterPid === $pid: |
|
| 57 | + $role = 'master'; |
|
| 58 | + break; |
|
| 59 | + default: |
|
| 60 | + $role = 'worker'; |
|
| 61 | + break; |
|
| 62 | 62 | } |
| 63 | 63 | fputs( |
| 64 | 64 | $this->destination, |