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 ProcessWorker
{
/**
* @var int
*/
protected $interval;
* @var ProcessInterface
public $process;
* ProcessWorker constructor.
*
* @param string $process
* @param OutputInterface $output
* @param int $interval
public function __construct(string $process, OutputInterface $output, int $interval = 100)
$this->pid = getmypid();
pid
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;
$this->process = new $process($output, $this);
$this->interval = $interval;
//???
}
public function runProcess()
while (true) {
$this->process->exec();
usleep($this->interval * 1000);
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: