Tebru\Retrofit\Generation\HandlerStack::push PHP Method

push() public method

Add a handler to the stack
public push ( Tebru\Retrofit\Generation\Handler $handler )
$handler Tebru\Retrofit\Generation\Handler
    public function push(Handler $handler)
    {
        $this->stack[] = $handler;
    }

Usage Example

コード例 #1
0
 /**
  * Handle the event
  *
  * @param MethodEvent $event
  */
 public function __invoke(MethodEvent $event)
 {
     $methodModel = $event->getMethodModel();
     $annotations = $event->getAnnotationCollection();
     $annotationProvider = new AnnotationProvider($annotations, $methodModel);
     $body = new Body();
     $stack = new HandlerStack(new HandlerContext($annotationProvider, $body, new ArrayPrinter()));
     $stack->push(new UrlHandler());
     $stack->push(new HeaderHandler());
     $stack->push(new BodyHandler());
     $stack->push(new ResponseHandler());
     $stack->push(new ReturnHandler());
     $stack->execute();
     $methodModel->setBody($body);
 }
All Usage Examples Of Tebru\Retrofit\Generation\HandlerStack::push