for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Eclipxe\SoftDaemon\Examples;
use Eclipxe\SoftDaemon\Executable;
class ExampleExecutable implements Executable
{
/** @var int */
protected $counter = 0;
/** @var array<int, bool> */
protected $returns;
/** @param array<int, bool> $returns */
public function __construct(array $returns)
$this->returns = $returns;
}
public function signalHandler(int $signo): void
echo 'ExampleExecutable process ', $signo, "\n";
if (SIGHUP === $signo) {
$this->counter = 0;
public function runOnce(): bool
$return = array_key_exists($this->counter, $this->returns) ? $this->returns[$this->counter] : false;
echo "Try to run $this->counter time: ", ($return) ? 'TRUE' : 'FALSE', "\n";
$this->counter = $this->counter + 1;
return $return;