Worker::runAll()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 15
ccs 9
cts 9
cp 1
crap 1
rs 9.4285
c 1
b 0
f 0
1
<?php
2
namespace Laravoole\Workerman;
3
4
class Worker extends \Workerman\Worker
5
{
6 8
	public static function runAll()
7
	{
8 8
	    self::checkSapiEnv();
9 8
	    self::init();
10 8
	    self::parseCommand();
11 8
	    self::daemonize();
12 8
	    self::initWorkers();
13 8
	    self::installSignal();
14 8
	    self::saveMasterPid();
15 8
	    self::forkWorkers();
16
	    // @codeCoverageIgnoreStart
17
	    self::resetStd();
18
	    self::monitorWorkers();
19
	    // @codeCoverageIgnoreEnd
20
	} // @codeCoverageIgnore
21
22 8
    protected static function parseCommand()
23
    {
24 8
        global $argv;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
25
        $argv = [
26 8
            __FILE__,
27 4
            'start',
28 4
        ];
29 8
        parent::parseCommand();
30 8
    }
31
}
32