for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Phppm;
use Symfony\Component\Console\Output\OutputInterface;
class ProcessManager implements ProcessManagerInterface
{
protected $workers;
public function addWorker(string $process, OutputInterface $output, int $time)
$descriptorspec = [
0 => ["pipe", "r"], // stdin is a pipe that the child will read from
1 => ["pipe", "w"], // stdout is a pipe that the child will write to
2 => ["file", "/tmp/error-output.txt", "a"] // stderr is a file to write to
];
$process = proc_open('php', $descriptorspec, $this->pipes);
pipes
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
dump(proc_get_status($process));
stream_set_blocking($this->pipes[1], 0);
stream_set_blocking($this->pipes[2], 0);
dump($this->pipes);
// fclose($this->pipes[0]);
// fclose($this->pipes[1]);
// proc_close($process);
proc_terminate($process);
// $this->workers[] = $worker;
}
public function removeWorker()
// TODO: Implement removeWorker() method.
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: