/** * The constructor * @param string $filename The filename to output * @throws \InvalidArgumentException */ public function __construct($filename) { if (!is_string($filename)) { throw new \InvalidArgumentException('The filename argument must be of type string'); } $this->filename = $filename; parent::__construct(''); }
/** * The constructor * * @param string $content The content of the response * @throws \InvalidArgumentException */ public function __construct($content = '') { if (!is_string($content)) { throw new \InvalidArgumentException('The content argument must be of type string'); } parent::__construct($content); $this->setContentType('text/html'); }
/** * The constructor * * @param string $content The content of the response * @throws \InvalidArgumentException */ public function __construct($content = '') { if (!is_string($content)) { throw new \InvalidArgumentException('The content argument must be of type string'); } parent::__construct($content); $this->charset = 'UTF-8'; $this->headers->set('Content-Type', 'text/html'); }
/** * The constructor * * @param string $content The content of the response * @throws \InvalidArgumentException */ public function __construct($content = 'Not Found') { if (!is_string($content)) { throw new \InvalidArgumentException('The content argument must be of type string'); } parent::__construct($content); $this->setContentType('text/plain'); $this->setStatusCode(404); }
/** * The constructor * * @param string $content The content of the response * @throws \InvalidArgumentException */ public function __construct($content = 'Temporary Unavailable') { if (!is_string($content)) { throw new \InvalidArgumentException('The content argument must be of type string'); } parent::__construct($content); $this->setContentType('text/plain'); $this->setStatusCode(503); }
/** * The constructor * @param string $url The redirect url * @throws \InvalidArgumentException */ public function __construct($url) { if (!is_string($url)) { throw new \InvalidArgumentException('The url argument must be of type string'); } parent::__construct(''); $this->setContentType('text/plain'); $this->setStatusCode(301); $this->headers['location'] = 'Location: ' . $url; }
/** * The constructor * * @param string $content The content of the response * @throws \InvalidArgumentException */ public function __construct($content = 'Temporary Unavailable') { if (!is_string($content)) { throw new \InvalidArgumentException('The content argument must be of type string'); } parent::__construct($content); $this->statusCode = 503; $this->charset = 'UTF-8'; $this->headers->set('Content-Type', 'text/plain'); }
/** * The constructor * * @param string $url The redirect url * @throws \InvalidArgumentException */ public function __construct($url) { if (!is_string($url)) { throw new \InvalidArgumentException('The url argument must be of type string'); } parent::__construct(''); $this->statusCode = 307; $this->headers->set('Content-Type', 'text/plain'); $this->headers->set('Location', $url); }
/** * The constructor * * @param string $filename The filename to output * @throws \InvalidArgumentException */ public function __construct($filename) { if (!is_string($filename)) { throw new \InvalidArgumentException('The filename argument must be of type string'); } $filename = realpath($filename); if ($filename === false) { throw new \InvalidArgumentException('The filename specified does not exist'); } $this->filename = $filename; parent::__construct(''); }
/** * The constructor * * @param string $filename The filename to output * @throws \InvalidArgumentException */ public function __construct($filename) { parent::__construct(''); $this->defineProperty('filename', ['init' => function () { return ''; }, 'set' => function ($value) { if (!is_string($value)) { throw new \InvalidArgumentException('The filename argument must be of type string'); } $value = realpath($value); if ($value === false || !is_readable($value)) { throw new \InvalidArgumentException('The filename specified does not exist or is not readable'); } return $value; }, 'unset' => function () { return ''; }]); $this->filename = $filename; }