Changeset View
Changeset View
Standalone View
Standalone View
src/future/http/status/HTTPFutureHTTPResponseStatus.php
| Show All 34 Lines | final class HTTPFutureHTTPResponseStatus extends HTTPFutureResponseStatus { | ||||
| } | } | ||||
| protected function getErrorCodeType($code) { | protected function getErrorCodeType($code) { | ||||
| return 'HTTP'; | return 'HTTP'; | ||||
| } | } | ||||
| public function isError() { | public function isError() { | ||||
| if ($this->expect === null) { | if ($this->expect === null) { | ||||
| return ($this->getStatusCode() < 200) || ($this->getStatusCode() > 299); | return ($this->getStatusCode() < 200) || ($this->getStatusCode() > 299); | ||||
| } | } | ||||
| return !in_array($this->getStatusCode(), $this->expect, true); | return !in_array($this->getStatusCode(), $this->expect, true); | ||||
| } | } | ||||
| public function isRedirect() { | |||||
| $code = $this->getStatusCode(); | |||||
| return ($code >= 300 && $code < 400); | |||||
| } | |||||
| public function isTimeout() { | public function isTimeout() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| protected function getErrorCodeDescription($code) { | protected function getErrorCodeDescription($code) { | ||||
| static $map = array( | static $map = array( | ||||
| 404 => 'Not Found', | 404 => 'Not Found', | ||||
| 500 => 'Internal Server Error', | 500 => 'Internal Server Error', | ||||
| ); | ); | ||||
| return idx($map, $code)."\n".$this->excerpt."\n"; | return idx($map, $code)."\n".$this->excerpt."\n"; | ||||
| } | } | ||||
| } | } | ||||