X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FHTTPException.php;h=f59ff547c9ba457770ce614ae1d1a04817687d9e;hb=322b7c856ca9ba53bd9c7da50dd5c1e3c9197d56;hp=b9bad457da13b0dbd17b45b7145abc1c12597197;hpb=c845415a99ebc348103815a7b2c55b15c75cdd24;p=friendica.git diff --git a/src/Network/HTTPException.php b/src/Network/HTTPException.php index b9bad457da..f59ff547c9 100644 --- a/src/Network/HTTPException.php +++ b/src/Network/HTTPException.php @@ -1,27 +1,51 @@ . * - * This list of Exception has be extracted from - * here http://racksburg.com/choosing-an-http-status-code/ */ namespace Friendica\Network; use Exception; -class HTTPException extends Exception +/** + * Throwable exceptions to return HTTP status code + * + * This list of Exception has been extracted from + * here http://racksburg.com/choosing-an-http-status-code/ + */ +abstract class HTTPException extends Exception { - var $httpcode = 200; - var $httpdesc = ""; + protected $httpdesc = ''; + protected $explanation = ''; + + public function __construct($message = '', Exception $previous = null) + { + parent::__construct($message, $this->code, $previous); + } + + public function getDescription() + { + return $this->httpdesc; + } - public function __construct($message = '', $code = 0, Exception $previous = null) + public function getExplanation() { - if ($this->httpdesc == '') { - $classname = str_replace('Exception', '', str_replace('Friendica\Network\HTTPException\\', '', get_class($this))); - $this->httpdesc = preg_replace("|([a-z])([A-Z])|",'$1 $2', $classname); - } - parent::__construct($message, $code, $previous); + return $this->explanation; } }