for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
/**
* It's free open-source software released under the MIT License.
*
* @author Anatoly Fenric <[email protected]>
* @copyright Copyright (c) 2018, Anatoly Fenric
* @license https://github.com/sunrise-php/http-router/blob/master/LICENSE
* @link https://github.com/sunrise-php/http-router
*/
namespace Sunrise\Http\Router\Middleware;
* Import classes
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
* CallableMiddleware
* @since 2.8.0
class CallableMiddleware implements MiddlewareInterface
{
* The middleware callback
* @var callable
private $callback;
* Constructor of the class
* @param callable $callback
public function __construct(callable $callback)
$this->callback = $callback;
}
* {@inheritDoc}
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
return ($this->callback)($request, $handler);