AbstractServerCommand::getProcessId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
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