src/main/php/ehough/shortstop/impl/DefaultHttpClient.php
public final function execute(ehough_shortstop_api_HttpRequest $request)
    {
        /**
         * Fire request event.
         */
        $requestEvent = new ehough_tickertape_GenericEvent($request);
        $this->_eventDispatcher->dispatch(ehough_shortstop_api_Events::REQUEST, $requestEvent);

        /**
         * Execute the chain.
         */
        $chainContext = new ehough_chaingang_impl_StandardContext();
        $chainContext->put('request', $request);
        $result = $this->_executionChain->execute($chainContext);

        if (!$result || !$chainContext->containsKey('response') || (!($chainContext->get('response') instanceof ehough_shortstop_api_HttpResponse))) {

            throw new ehough_shortstop_api_exception_RuntimeException(sprintf('No HTTP transports could execute %s', $request));
        }

        /**
         * Fire response event.
         */
        $response      = $chainContext->get('response');
        $responseEvent = new ehough_tickertape_GenericEvent($response, array('request' => $requestEvent->getSubject()));
        $this->_eventDispatcher->dispatch(ehough_shortstop_api_Events::RESPONSE, $responseEvent);

        /**
         * All done. Return the response.
         */
        return $response;
    }
public final function execute(ehough_shortstop_api_HttpRequest $request)
    {
        /**
         * Fire request event.
         */
        $requestEvent = new ehough_tickertape_GenericEvent($request);
        $this->_eventDispatcher->dispatch(ehough_shortstop_api_Events::REQUEST, $requestEvent);

        /**
         * Execute the chain.
         */
        $chainContext = new ehough_chaingang_impl_StandardContext();
        $chainContext->put('request', $request);
        $result = $this->_executionChain->execute($chainContext);

        if (!$result || !$chainContext->containsKey('response') || (!($chainContext->get('response') instanceof ehough_shortstop_api_HttpResponse))) {

            throw new ehough_shortstop_api_exception_RuntimeException(sprintf('No HTTP transports could execute %s', $request));
        }

        /**
         * Fire response event.
         */
        $response      = $chainContext->get('response');
        $responseEvent = new ehough_tickertape_GenericEvent($response, array('request' => $requestEvent->getSubject()));
        $this->_eventDispatcher->dispatch(ehough_shortstop_api_Events::RESPONSE, $responseEvent);

        /**
         * All done. Return the response.
         */
        return $response;
    }
public final function execute ( ehough_shortstop_api_HttpRequest $ request ) { /**
         * Fire request event.
         */ $ requestEvent = new ehough_tickertape_GenericEvent ( $ request ) ; $ this -> _eventDispatcher -> dispatch ( ehough_shortstop_api_Events :: REQUEST , $ requestEvent ) ; /**
         * Execute the chain.
         */ $ chainContext = new ehough_chaingang_impl_StandardContext ( ) ; $ chainContext -> put ( 'request' , $ request ) ; $ result = $ this -> _executionChain -> execute ( $ chainContext ) ; if ( ! $ result || ! $ chainContext -> containsKey ( 'response' ) || ( ! ( $ chainContext -> get ( 'response' ) instanceof ehough_shortstop_api_HttpResponse ) ) ) { throw new ehough_shortstop_api_exception_RuntimeException ( sprintf ( 'No HTTP transports could execute %s' , $ request ) ) ; } /**
         * Fire response event.
         */ $ response = $ chainContext -> get ( 'response' ) ; $ responseEvent = new ehough_tickertape_GenericEvent ( $ response , array ( 'request' => $ requestEvent -> getSubject ( ) ) ) ; $ this -> _eventDispatcher -> dispatch ( ehough_shortstop_api_Events :: RESPONSE , $ responseEvent ) ; /**
         * All done. Return the response.
         */ return $ response ; }
Execute a given HTTP request.

@param ehough_shortstop_api_HttpRequest $request The HTTP request.

@throws ehough_shortstop_api_exception_RuntimeException If something goes wrong.

@return ehough_shortstop_api_HttpResponse The HTTP response.
Execute a given HTTP request .