PHP Class Phly\Conduit\Next

显示文件 Open project: phly/conduit

Public Methods

Method Description
__construct ( SplQueue $queue, callable $done )
__invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, null | mixed $err = null ) : Psr\Http\Message\ResponseInterface Call the next Route in the queue.

Private Methods

Method Description
getBorder ( string $path, string $route ) : string Determine the border between the request path and current route
getTruncatedPath ( string $segment, string $path ) : string Strip the segment from the start of the given path.
resetPath ( Request $request ) : Request Reset the path, if a segment was previously stripped
stripRouteFromPath ( Request $request, string $route ) : Request Strip the route from the request path

Method Details

__construct() public method

public __construct ( SplQueue $queue, callable $done )
$queue SplQueue
$done callable

__invoke() public method

Next requires that a request and response are provided; these will be passed to any middleware invoked, including the $done callable, if invoked. If the $err value is not null, the invocation is considered to be an error invocation, and Next will search for the next error middleware to dispatch, passing it $err along with the request and response. Once dispatch is complete, if the result is a response instance, that value will be returned; otherwise, the currently registered response instance will be returned.
public __invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, null | mixed $err = null ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\ServerRequestInterface
$response Psr\Http\Message\ResponseInterface
$err null | mixed
return Psr\Http\Message\ResponseInterface