AbstractServerCommand   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 3
c 1
b 0
f 0
dl 0
loc 11
ccs 0
cts 3
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getProcessId() 0 4 1
1
<?php
2
3
/**
4
 * @namespace
5
 */
6
7
namespace Bluzman\Command\Server;
8
9
use Bluzman\Command\AbstractCommand;
10
11
/**
12
 * AbstractServerCommand
13
 *
14
 * @package  Bluzman\Command\Server
15
 * @author   Anton Shevchuk
16
 */
17
abstract class AbstractServerCommand extends AbstractCommand
18
{
19
    /**
20
     * @param string $host
21
     * @param integer $port
22
     * @return string
23
     */
24
    protected function getProcessId(string $host, int $port)
25
    {
26
        return trim(
27
            shell_exec("ps aux | grep 'php -S $host:$port' | grep -v grep | grep -v BLUZ_ENV | awk '{print $2}'")
28
        );
29
    }
30
}
31