Passed
Push — master ( 6ce97f...1fe2f9 )
by huang
05:13
created

DemoProcessor::handle()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 1
nop 1
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author    jan huang <[email protected]>
4
 * @copyright 2017
5
 *
6
 * @see      https://www.github.com/janhuang
7
 * @see      https://fastdlabs.com
8
 */
9
10
namespace Processor;
11
12
use FastD\Swoole\Process;
13
use swoole_process;
14
15
class DemoProcessor extends Process
16
{
17
    public function handle(swoole_process $swoole_process)
18
    {
19
        timer_tick(1000, function ($id) {
20
            static $index = 0;
21
            ++$index;
22
            echo $index.PHP_EOL;
23
            if (3 === $index) {
24
                timer_clear($id);
25
            }
26
        });
27
    }
28
}
29