Exemplo n.º 1
0
 public function testUnregisteredKeyThrowsException()
 {
     $instance = new RequestResponse();
     $this->setExpectedException('InvalidArgumentException');
     $instance->get('Foo');
 }
Exemplo n.º 2
0
 private function postResponseToCallback(RequestResponse $requestResponse)
 {
     $requestResponse->set('requestProcTime', microtime(true) - $requestResponse->get('requestProcTime'));
     if (is_callable($this->getOption(ONOI_HTTP_REQUEST_ON_COMPLETED_CALLBACK)) && $requestResponse->get('wasCompleted')) {
         call_user_func_array($this->getOption(ONOI_HTTP_REQUEST_ON_COMPLETED_CALLBACK), array($requestResponse));
     }
     if (is_callable($this->getOption(ONOI_HTTP_REQUEST_ON_FAILED_CALLBACK)) && (!$requestResponse->get('wasCompleted') || !$requestResponse->get('wasAccepted'))) {
         call_user_func_array($this->getOption(ONOI_HTTP_REQUEST_ON_FAILED_CALLBACK), array($requestResponse));
     }
 }