for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Itkg\DelayEventBundle\Handler;
use Itkg\DelayEventBundle\DomainManager\LockManagerInterface;
/**
* Class CommandLockHandler
*/
class CommandLockHandler implements LockHandlerInterface
{
* @var LockManagerInterface
private $lockManager;
* @param LockManagerInterface $lockManager
public function __construct(LockManagerInterface $lockManager)
$this->lockManager = $lockManager;
}
* {@inheritdoc}
public function isLocked($channel)
$lock = $this->lockManager->getLock($channel);
return $lock->isCommandLocked();
public function lock($channel)
$this->setLockStatusForChannel($channel, true);
public function release($channel)
$this->setLockStatusForChannel($channel, false);
* @param string $channel
* @param bool $locked
private function setLockStatusForChannel($channel, $locked)
$lock->setCommandLocked($locked);
$this->lockManager->save($lock);