X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FHTTPException.php;h=c2f5c4867d43567748e7260bce85dd6623bb6ffe;hb=0ab5fed64cdd737817489434f0f008646a28a61d;hp=7602290c2b873c3a7e8eddea441260e8b7feed4c;hpb=365850f26a1cbbcc9e051a1e24fec2b35613b48c;p=friendica.git diff --git a/src/Network/HTTPException.php b/src/Network/HTTPException.php index 7602290c2b..c2f5c4867d 100644 --- a/src/Network/HTTPException.php +++ b/src/Network/HTTPException.php @@ -1,27 +1,51 @@ -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); - } -} +. + * + */ + +namespace Friendica\Network; + +use 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 +{ + protected $httpdesc = ''; + protected $explanation = ''; + + public function __construct(string $message = '', Exception $previous = null) + { + parent::__construct($message, $this->code, $previous); + } + + public function getDescription() + { + return $this->httpdesc; + } + + public function getExplanation() + { + return $this->explanation; + } +}