Exemplo n.º 1
0
 /**
  * @param string|\SplFileInfo $file
  * @param Request $request
  * @param array $options
  * @param array $headers
  */
 public function __construct($file, Request $request, array $options = [], $headers = [])
 {
     $this->file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file);
     $this->request = $request;
     $this->apply_options($options, $headers);
     parent::__construct(function () {
         if (!$this->status->is_successful) {
             return;
         }
         $this->send_file($this->file);
     }, Status::OK, $headers);
 }
Exemplo n.º 2
0
 /**
  * Initializes the {@link $errors} property.
  *
  * @inheritdoc
  */
 public function __construct($body = null, $status = 200, array $headers = [])
 {
     parent::__construct($body, $status, $headers);
     $this->errors = new Errors();
 }