public function setStatus($status) { if (!is_int($status)) { $status = StatusCodes::getCode($status); } $this->status = $status; return $this; }
public function handle() { $status = $this->response()->status(); $filePath = $this->getService('rails.config')['paths']['public_path']->extend($status . '.html'); if (is_file($filePath)) { $body = file_get_contents($filePath); } else { $body = sprintf(Reporter::ERROR_NOTICE, $status, StatusCodes::getName($status)); } $this->response()->setBody($body); }
public function matches($other) { $responseStatus = $this->controller->response()->status(); if (null === $responseStatus) { $responseStatus = 200; } elseif (!is_int($responseStatus)) { $responseStatus = StatusCodes::getCode($responseStatus); } if (is_string($other)) { if (in_array($other, self::$RANGED_STATUS_TYPES)) { return $this->matchRangedStatus($other, $responseStatus); } else { $otherCode = StatusCodes::getCode($other); return $otherCode == $responseStatus; } } elseif (is_int($other)) { return $other == $responseStatus; } else { throw new \InvalidArgumentException(sprintf("First argument must be either string or int, %s passed", gettype($other))); } }
protected function errorNotice($e, $status) { return sprintf(self::ERROR_NOTICE, $status, StatusCodes::getName($status)); }