PHP 클래스 Zend\Stratigility\MiddlewarePipe

This class implements a pipeline of middleware, which can be attached using the pipe() method, and is itself middleware. The request and response objects are decorated using the Zend\Stratigility\Http variants in this package, ensuring that the request may store arbitrary properties, and the response exposes the convenience write(), end(), and isComplete() methods. It creates an instance of Next internally, invoking it with the provided request and response instances; if no $out argument is provided, it will create a FinalHandler instance and pass that to Next as well. Inspired by Sencha Connect.
또한 보기: https://github.com/sencha/connect
상속: implements Zend\Stratigility\MiddlewareInterface, implements Interop\Http\Middleware\ServerMiddlewareInterface
파일 보기 프로젝트 열기: zendframework/zend-stratigility 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$pipeline SplQueue
$responsePrototype Psr\Http\Message\ResponseInterface

공개 메소드들

메소드 설명
__construct ( ) Constructor
__invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $out = null ) : Psr\Http\Message\ResponseInterface Handle a request
hasResponsePrototype ( ) : boolean
pipe ( string | callable | object $path, null | callable | object $middleware = null ) : self Attach middleware to the pipeline.
process ( Psr\Http\Message\ServerRequestInterface $request, Interop\Http\Middleware\DelegateInterface $delegate ) : Psr\Http\Message\ResponseInterface http-interop invocation: single-pass with delegate.
raiseThrowables ( ) : void Enable the "raise throwables" flag.
setResponsePrototype ( Psr\Http\Message\ResponseInterface $prototype ) : void

비공개 메소드들

메소드 설명
decorateCallableMiddleware ( callable $middleware ) : Interop\Http\Middleware\ServerMiddlewareInterface | callable
decorateRequest ( Psr\Http\Message\ServerRequestInterface $request ) : Request Decorate the Request instance
decorateResponse ( Psr\Http\Message\ResponseInterface $response ) : Response Decorate the Response instance
getReflectionFunction ( callable $middleware ) : ReflectionFunctionAbstract
isErrorMiddleware ( mixed $middleware ) : boolean Is the middleware error middleware?
isInteropMiddleware ( mixed $middleware ) : boolean Is the provided middleware argument http-interop middleware?
isValidMiddleware ( mixed $middleware ) : boolean Is the provided middleware argument valid middleware?
normalizePipePath ( string $path ) : string Normalize a path used when defining a pipe

메소드 상세

__construct() 공개 메소드

Initializes the queue.
public __construct ( )

__invoke() 공개 메소드

Takes the pipeline, creates a Next handler, and delegates to the Next handler. If $out is a callable, it is used as the "final handler" when $next has exhausted the pipeline; otherwise, a FinalHandler instance is created and passed to $next during initialization.
public __invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $out = null ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\ServerRequestInterface
$response Psr\Http\Message\ResponseInterface
$out callable
리턴 Psr\Http\Message\ResponseInterface

hasResponsePrototype() 공개 메소드

public hasResponsePrototype ( ) : boolean
리턴 boolean

pipe() 공개 메소드

Each middleware can be associated with a particular path; if that path is matched when that middleware is invoked, it will be processed; otherwise it is skipped. No path means it should be executed every request cycle. A handler CAN implement MiddlewareInterface, but MUST be callable. Handlers with arity >= 4 or those implementing ErrorMiddlewareInterface are considered error handlers, and will be executed when a handler calls $next with an error or raises an exception.
또한 보기: MiddlewareInterface
또한 보기: ErrorMiddlewareInterface
또한 보기: Next
public pipe ( string | callable | object $path, null | callable | object $middleware = null ) : self
$path string | callable | object Either a URI path prefix, or middleware.
$middleware null | callable | object Middleware
리턴 self

process() 공개 메소드

Executes the internal pipeline, passing $delegate as the "final handler" in cases when the pipeline exhausts itself.
public process ( Psr\Http\Message\ServerRequestInterface $request, Interop\Http\Middleware\DelegateInterface $delegate ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\ServerRequestInterface
$delegate Interop\Http\Middleware\DelegateInterface
리턴 Psr\Http\Message\ResponseInterface

raiseThrowables() 공개 메소드

Enable the "raise throwables" flag.
public raiseThrowables ( ) : void
리턴 void

setResponsePrototype() 공개 메소드

public setResponsePrototype ( Psr\Http\Message\ResponseInterface $prototype ) : void
$prototype Psr\Http\Message\ResponseInterface
리턴 void

프로퍼티 상세

$pipeline 보호되어 있는 프로퍼티

protected SplQueue $pipeline
리턴 SplQueue

$responsePrototype 보호되어 있는 프로퍼티

protected ResponseInterface,Psr\Http\Message $responsePrototype
리턴 Psr\Http\Message\ResponseInterface