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

DemoProcessor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 2
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