Worker   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 28
ccs 16
cts 16
cp 1
rs 10
c 1
b 0
f 0
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A runAll() 0 15 1
A parseCommand() 0 9 1
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