for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* GpsLab component.
*
* @author Peter Gribanov <[email protected]>
* @copyright Copyright (c) 2011, Peter Gribanov
* @license http://opensource.org/licenses/MIT
*/
namespace GpsLab\Component\Command\Queue\Subscribe;
use GpsLab\Component\Command\Command;
class ExecutingSubscribeCommandQueue implements SubscribeCommandQueue
{
* @var callable|null
private $handler;
* Publish command to queue.
* @param Command $command
* @return bool
public function publish(Command $command)
// absence of a handler is not a error
if (is_callable($this->handler)) {
call_user_func($this->handler, $command);
}
return true;
* Subscribe on command queue.
* @param callable $handler
public function subscribe(callable $handler)
$this->handler = $handler;