public function getResponse()
    {
        $this->response = new ResponseDocument();
        $this->response->addElement("responseDate", $this->toUtcDateTime(new \DateTime()));
        $requestNode = $this->response->createElement("request", $this->repository->getBaseUrl());
        $this->response->getDocument()->documentElement->appendChild($requestNode);

        try {
            $this->checkVerb();
            $verbOutput = $this->doVerb();

            // we are sure now that all request variables are correct otherwise an error would have been thrown
            foreach ($this->params as $k => $v) {
                $requestNode->setAttribute($k, $v);
            }

            // the element is only added when everything went fine, otherwise we would add error node(s) in the catch
            // block below
            $this->response->getDocument()->documentElement->appendChild($verbOutput);

            // Shift the records from the records stack and add them to the DOM tree
            // Records proper are always stored in the 'metadata' node
            foreach ($this->response->getDocument()->getElementsByTagName('metadata') as $item) {
                $record = array_shift($this->records);
                $node = $this->response->getDocument()->importNode($record->documentElement, true);
                $item->appendChild($node);
            }
        } catch (MultipleExceptions $errors) {
            //multiple errors happened add all of the to the response
            foreach ($errors as $error) {
                $this->response->addError($error);
            }
        } catch (\Exception $error) {
            //add this error to the response
            if ($error instanceof Exception) {
                $this->response->addError($error);
            } else {
                $this->response->addError(new Exception($error->getMessage()));
            }
        }

        return $this->response->getResponse();
    }
public function getResponse()
    {
        $this->response = new ResponseDocument();
        $this->response->addElement("responseDate", $this->toUtcDateTime(new \DateTime()));
        $requestNode = $this->response->createElement("request", $this->repository->getBaseUrl());
        $this->response->getDocument()->documentElement->appendChild($requestNode);

        try {
            $this->checkVerb();
            $verbOutput = $this->doVerb();

            // we are sure now that all request variables are correct otherwise an error would have been thrown
            foreach ($this->params as $k => $v) {
                $requestNode->setAttribute($k, $v);
            }

            // the element is only added when everything went fine, otherwise we would add error node(s) in the catch
            // block below
            $this->response->getDocument()->documentElement->appendChild($verbOutput);

            // Shift the records from the records stack and add them to the DOM tree
            // Records proper are always stored in the 'metadata' node
            foreach ($this->response->getDocument()->getElementsByTagName('metadata') as $item) {
                $record = array_shift($this->records);
                $node = $this->response->getDocument()->importNode($record->documentElement, true);
                $item->appendChild($node);
            }
        } catch (MultipleExceptions $errors) {
            //multiple errors happened add all of the to the response
            foreach ($errors as $error) {
                $this->response->addError($error);
            }
        } catch (\Exception $error) {
            //add this error to the response
            if ($error instanceof Exception) {
                $this->response->addError($error);
            } else {
                $this->response->addError(new Exception($error->getMessage()));
            }
        }

        return $this->response->getResponse();
    }
public function getResponse ( ) { $ this -> response = new ResponseDocument ( ) ; $ this -> response -> addElement ( "responseDate" , $ this -> toUtcDateTime ( new \ DateTime ( ) ) ) ; $ requestNode = $ this -> response -> createElement ( "request" , $ this -> repository -> getBaseUrl ( ) ) ; $ this -> response -> getDocument ( ) -> documentElement -> appendChild ( $ requestNode ) ; try { $ this -> checkVerb ( ) ; $ verbOutput = $ this -> doVerb ( ) ; // we are sure now that all request variables are correct otherwise an error would have been thrown foreach ( $ this -> params as $ k => $ v ) { $ requestNode -> setAttribute ( $ k , $ v ) ; } // the element is only added when everything went fine, otherwise we would add error node(s) in the catch // block below $ this -> response -> getDocument ( ) -> documentElement -> appendChild ( $ verbOutput ) ; // Shift the records from the records stack and add them to the DOM tree // Records proper are always stored in the 'metadata' node foreach ( $ this -> response -> getDocument ( ) -> getElementsByTagName ( 'metadata' ) as $ item ) { $ record = array_shift ( $ this -> records ) ; $ node = $ this -> response -> getDocument ( ) -> importNode ( $ record -> documentElement , true ) ; $ item -> appendChild ( $ node ) ; } } catch ( MultipleExceptions $ errors ) { //multiple errors happened add all of the to the response foreach ( $ errors as $ error ) { $ this -> response -> addError ( $ error ) ; } } catch ( \ Exception $ error ) { //add this error to the response if ( $ error instanceof Exception ) { $ this -> response -> addError ( $ error ) ; } else { $ this -> response -> addError ( new Exception ( $ error -> getMessage ( ) ) ) ; } } return $ this -> response -> getResponse ( ) ; }
handles the current request
@return ResponseInterface
handles the current request