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\Middleware\Command\Handler;
use GpsLab\Component\Command\Bus\CommandBus;
use GpsLab\Component\Command\Command;
use GpsLab\Component\Middleware\Handler\MiddlewareHandler;
class CommandMiddlewareHandler implements MiddlewareHandler
{
* @var CommandBus
private $bus;
* @param CommandBus $bus
public function __construct(CommandBus $bus)
$this->bus = $bus;
}
* @param mixed $message
* @param callable $next
* @return mixed
public function handle($message, callable $next)
if ($message instanceof Command) {
return $next($this->bus->handle($message));
return $next($message);