| Total Complexity | 6 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 92.86% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class PidManager |
||
| 10 | { |
||
| 11 | private $pathToPidFile; |
||
| 12 | |||
| 13 | 1 | public function __construct(string $pathToPidFile) |
|
| 16 | } |
||
| 17 | |||
| 18 | 1 | public function pidExists(): bool |
|
| 21 | } |
||
| 22 | |||
| 23 | 1 | public function readPid(): int |
|
| 24 | { |
||
| 25 | 1 | $pid = Safe\file_get_contents($this->pathToPidFile); |
|
| 26 | 1 | return (int) $pid; |
|
| 27 | } |
||
| 28 | |||
| 29 | 1 | public function writePid(int $pid = null): void |
|
| 30 | { |
||
| 31 | 1 | $pid = $pid ?? posix_getpid(); |
|
| 32 | 1 | Safe\file_put_contents($this->pathToPidFile, $pid); |
|
| 33 | } |
||
| 34 | |||
| 35 | 1 | public function removePid(): void |
|
| 42 | } |
||
| 43 | } |
||
| 44 |