| Conditions | 1 |
| Paths | 1 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function addWorker(string $process, OutputInterface $output, int $time) |
||
| 12 | { |
||
| 13 | $descriptorspec = [ |
||
| 14 | 0 => ["pipe", "r"], // stdin is a pipe that the child will read from |
||
| 15 | 1 => ["pipe", "w"], // stdout is a pipe that the child will write to |
||
| 16 | 2 => ["file", "/tmp/error-output.txt", "a"] // stderr is a file to write to |
||
| 17 | ]; |
||
| 18 | |||
| 19 | $process = proc_open('php', $descriptorspec, $this->pipes); |
||
|
|
|||
| 20 | |||
| 21 | dump(proc_get_status($process)); |
||
| 22 | |||
| 23 | stream_set_blocking($this->pipes[1], 0); |
||
| 24 | stream_set_blocking($this->pipes[2], 0); |
||
| 25 | dump($this->pipes); |
||
| 26 | |||
| 27 | // fclose($this->pipes[0]); |
||
| 28 | // fclose($this->pipes[1]); |
||
| 29 | |||
| 30 | proc_close($process); |
||
| 31 | |||
| 32 | |||
| 33 | // $this->workers[] = $worker; |
||
| 34 | } |
||
| 35 | |||
| 41 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: