X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FHTTPException.php;h=7ef1ca9828aca0e93147106f2f12d19cc716e68d;hb=27c738f90f5961ffcdc438810a93407e4544eead;hp=7602290c2b873c3a7e8eddea441260e8b7feed4c;hpb=4224209497a6c7f723ea2b4d989f99890bccc47f;p=friendica.git diff --git a/src/Network/HTTPException.php b/src/Network/HTTPException.php index 7602290c2b..7ef1ca9828 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; + } +}