OnWorkerStart::onWorkerStart()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 3
nop 2
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 8
cp 0
crap 12
1
<?php
2
/**
3
 * @author    jan huang <[email protected]>
4
 * @copyright 2016
5
 *
6
 * @see      https://www.github.com/janhuang
7
 * @see      https://fastdlabs.com
8
 */
9
10
namespace FastD\Servitization;
11
12
use FastD\Pool\PoolInterface;
13
use swoole_server;
14
15
/**
16
 * Trait OnWorkerStart.
17
 */
18
trait OnWorkerStart
19
{
20
    /**
21
     * @param swoole_server $server
22
     * @param int           $worker_id
23
     */
24
    public function onWorkerStart(swoole_server $server, $worker_id)
25
    {
26
        parent::onWorkerStart($server, $worker_id);
27
28
        foreach (app() as $service) {
29
            if ($service instanceof PoolInterface) {
30
                $service->initPool();
31
            }
32
        }
33
    }
34
}
35