Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
13 | public function isRunning(ImportPart $part) |
||
14 | { |
||
15 | if (null === $pid = $part->getProcess()) { |
||
16 | return false; |
||
17 | } |
||
18 | |||
19 | if (intval($pid) < 1) { |
||
20 | throw new \RuntimeException( |
||
21 | sprintf('Import part does not have a valid pid: %s', json_encode($pid)) |
||
22 | ); |
||
23 | } |
||
24 | |||
25 | // kill signal 0: check whether a process is running. |
||
26 | // see http://www.php.net/manual/en/function.posix-kill.php#82560 |
||
27 | return posix_kill($pid, 0); |
||
28 | } |
||
29 | |||
57 |