| Total Complexity | 6 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 4 | final class CliRunner |
||
| 5 | { |
||
| 6 | protected $workDir; |
||
| 7 | protected $script; |
||
| 8 | protected $pid = []; |
||
| 9 | |||
| 10 | public function __construct($workDir) |
||
| 11 | { |
||
| 12 | $this->workDir = $workDir; |
||
| 13 | } |
||
| 14 | |||
| 15 | public function start($script) |
||
| 16 | { |
||
| 17 | $this->pid[$script] = sprintf( |
||
| 18 | '%s%s%s.pid', |
||
| 19 | realpath($this->workDir), |
||
| 20 | DIRECTORY_SEPARATOR, |
||
| 21 | md5($script) |
||
| 22 | ); |
||
| 23 | touch($this->pid[$script]); |
||
| 24 | return true; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function hasPid($script) |
||
| 30 | } |
||
| 31 | |||
| 32 | public function finish($script) |
||
| 41 | } |
||
| 42 | } |
||
| 43 |