OnWorkerStart   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
ccs 0
cts 8
cp 0
wmc 3
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A onWorkerStart() 0 10 3
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