public function toResponse()
 {
     $response = parent::toResponse();
     $response->setHeader('Content-Type', 'application/xml; charset="utf-8"');
     $response->setEntity(function (StreamInterface $stream) {
         $xml = new XmlStreamWriter(new StreamWrapper($stream));
         $xml->registerNamespace(WebDav::NS_DAV, 'D');
         $xml->startDocument();
         $xml->startElement(WebDav::NS_DAV, 'error');
         $this->toXml($xml);
         $xml->endElement();
         // D:error
         $xml->endDocument();
         $xml->flush();
     });
     return $response;
 }
Example #2
0
 public function __construct($status = NULL, \Exception $cause = NULL)
 {
     $status = $status === NULL ? WebDav::CODE_INTERNAL_SERVER_ERROR : $status;
     parent::__construct($status, $cause);
     $this->message = WebDav::getReason($status);
 }
Example #3
0
 public function __construct(\Exception $cause = NULL)
 {
     parent::__construct(Http::CODE_NOT_FOUND, $cause);
 }
Example #4
0
 public function toResponse()
 {
     $response = parent::toResponse();
     $response->setEntity($this->entity);
     return $response;
 }
Example #5
0
 public function __construct(HttpResponse $response, \Exception $cause = NULL)
 {
     parent::__construct($response->getStatus(), $cause);
     $this->response = $response;
 }
 public function toResponse()
 {
     $response = parent::toResponse();
     $response->setHeader(new AllowHeader($this->allow));
     return $response;
 }
Example #7
0
 public function __construct(\Exception $cause = NULL)
 {
     parent::__construct(Http::CODE_BAD_REQUEST, $cause);
 }