Completed
Push — master ( 550846...8c8483 )
by Anton
09:53
created

AbstractServerCommand::getProcessId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
/**
3
 * @namespace
4
 */
5
6
namespace Bluzman\Command\Server;
7
8
use Bluzman\Command\AbstractCommand;
9
10
/**
11
 * AbstractServerCommand
12
 *
13
 * @package  Bluzman\Command\Server
14
 * @author   dark
15
 */
16
abstract class AbstractServerCommand extends AbstractCommand
17
{
18
    /**
19
     * @param string $host
20
     * @param integer $port
21
     * @return string
22
     */
23
    protected function getProcessId($host, $port)
24
    {
25
        return trim(
26
            shell_exec("ps aux | grep 'php -S $host:$port' | grep -v grep | grep -v BLUZ_ENV | awk '{print $2}'")
27
        );
28
    }
29
}
30