for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Tomaj\Hermes\Driver;
use Tomaj\Hermes\Restart\RestartException;
use Tomaj\Hermes\Restart\RestartInterface;
trait RestartTrait
{
/** @var RestartInterface */
private $restart;
private $startTime;
public function setRestart(RestartInterface $restart)
$this->restart = $restart;
$this->startTime = new \DateTime();
}
private function shouldRestart(): bool
return $this->restart && $this->restart->shouldRestart($this->startTime);
/**
* @throws RestartException
*/
private function checkRestart(): void
if ($this->shouldRestart()) {
throw new RestartException();