sforkowany z mirror/friendica
Add HTTPException class files
rodzic
fd8b9deaaf
commit
b41bf77ec8
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Throwable exceptions to return HTTP status code
|
||||
*
|
||||
* 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 {
|
||||
var $httpcode = 200;
|
||||
var $httpdesc = "";
|
||||
public function __construct($message = "", $code = 0, Exception $previous = null) {
|
||||
if ($this->httpdesc == "") {
|
||||
$this->httpdesc = preg_replace("|([a-z])([A-Z])|",'$1 $2', str_replace("Exception","",get_class($this)));
|
||||
}
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class BadGatewayException extends HTTPException
|
||||
{
|
||||
var $httpcode = 502;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class BadRequestException extends HTTPException
|
||||
{
|
||||
var $httpcode = 400;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class ConflictException extends HTTPException
|
||||
{
|
||||
var $httpcode = 409;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class ExpectationFailedException extends HTTPException
|
||||
{
|
||||
var $httpcode = 417;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class ForbiddenException extends HTTPException
|
||||
{
|
||||
var $httpcode = 403;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class GatewayTimeoutException extends HTTPException
|
||||
{
|
||||
var $httpcode = 504;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class GoneException extends HTTPException
|
||||
{
|
||||
var $httpcode = 410;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class ImATeapotException extends HTTPException
|
||||
{
|
||||
var $httpcode = 418;
|
||||
var $httpdesc = "I'm A Teapot";
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class InternalServerErrorException extends HTTPException
|
||||
{
|
||||
var $httpcode = 500;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class LenghtRequiredException extends HTTPException
|
||||
{
|
||||
var $httpcode = 411;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class MethodNotAllowedException extends HTTPException
|
||||
{
|
||||
var $httpcode = 405;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class NonAcceptableException extends HTTPException
|
||||
{
|
||||
var $httpcode = 406;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class NotFoundException extends HTTPException {
|
||||
var $httpcode = 404;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class NotImplementedException extends HTTPException
|
||||
{
|
||||
var $httpcode = 501;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class PreconditionFailedException extends HTTPException
|
||||
{
|
||||
var $httpcode = 412;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class ServiceUnavaiableException extends HTTPException
|
||||
{
|
||||
var $httpcode = 503;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class TooManyRequestsException extends HTTPException
|
||||
{
|
||||
var $httpcode = 429;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class UnauthorizedException extends HTTPException
|
||||
{
|
||||
var $httpcode = 401;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class UnprocessableEntityException extends HTTPException
|
||||
{
|
||||
var $httpcode = 422;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class UnsupportedMediaTypeException extends HTTPException
|
||||
{
|
||||
var $httpcode = 415;
|
||||
}
|
Ładowanie…
Reference in New Issue