Example #1
0
 /**
  * @return void
  */
 public function init()
 {
     parent::init();
     $this->addEventListener(Event\Type\Http\Request::toType(), function ($event) {
         $this->onHttpRequest($event);
     });
     $this->addEventListener(Event\Type\Http\Response200::toType(), function ($event) {
         $requestEvent = $event->getLastDispatchedEvent();
         $execResult = $requestEvent->getResult();
         return $this->onResponse200($event, $execResult);
     });
     $extendable = $this->getExtendableInstance();
     if ($extendable) {
         $routeAnnot = $extendable->getRouteAnnotation();
         $ctrlMethodAnnot = $extendable->getControllerMethodAnnotation();
         $this->setControllerMethod($ctrlMethodAnnot->getMethodName());
         $this->setAllowedHttpMethods($routeAnnot->getAllowedHttpMethods());
         $this->setURIMatchRegExp($routeAnnot->getURIMatchRegExp());
         $this->setURIMatchPattern($routeAnnot->getMatchPattern());
         $validator = $this->instantiateValidator();
         $this->setValidator($validator);
     }
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $this->type = Event\TYPE_UNICAST_BIDIRECTIONAL;
     $this->setAutoTriggerEvent(Event\Type\Http\Response200::create());
 }