/** * The constructor * @param string $content The content of the response * @throws \InvalidArgumentException */ 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 $filename The filename to output * @throws \InvalidArgumentException */ 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 */ 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 */ 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 */ 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(307); $this->headers['location'] = 'Location: ' . $url; }