Refactored project structure.

This commit is contained in:
Dmitry Khomutov 2018-03-04 18:04:15 +07:00
commit c015d8c58b
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
308 changed files with 39 additions and 47 deletions

View file

@ -0,0 +1,40 @@
<?php
namespace PHPCensor\Exception;
class HttpException extends \Exception
{
/**
* @var integer
*/
protected $errorCode = 500;
/**
* @var string
*/
protected $statusMessage = 'Internal Server Error';
/**
* @return integer
*/
public function getErrorCode()
{
return $this->errorCode;
}
/**
* @return string
*/
public function getStatusMessage()
{
return $this->statusMessage;
}
/**
* @return string
*/
public function getHttpHeader()
{
return 'HTTP/1.1 ' . $this->errorCode . ' ' . $this->statusMessage;
}
}

View file

@ -0,0 +1,18 @@
<?php
namespace PHPCensor\Exception\HttpException;
use PHPCensor\Exception\HttpException;
class BadRequestException extends HttpException
{
/**
* @var integer
*/
protected $errorCode = 400;
/**
* @var string
*/
protected $statusMessage = 'Bad Request';
}

View file

@ -0,0 +1,18 @@
<?php
namespace PHPCensor\Exception\HttpException;
use PHPCensor\Exception\HttpException;
class ForbiddenException extends HttpException
{
/**
* @var integer
*/
protected $errorCode = 403;
/**
* @var string
*/
protected $statusMessage = 'Forbidden';
}

View file

@ -0,0 +1,18 @@
<?php
namespace PHPCensor\Exception\HttpException;
use PHPCensor\Exception\HttpException;
class NotAuthorizedException extends HttpException
{
/**
* @var integer
*/
protected $errorCode = 401;
/**
* @var string
*/
protected $statusMessage = 'Not Authorized';
}

View file

@ -0,0 +1,18 @@
<?php
namespace PHPCensor\Exception\HttpException;
use PHPCensor\Exception\HttpException;
class NotFoundException extends HttpException
{
/**
* @var integer
*/
protected $errorCode = 404;
/**
* @var string
*/
protected $statusMessage = 'Not Found';
}

View file

@ -0,0 +1,9 @@
<?php
namespace PHPCensor\Exception\HttpException;
use PHPCensor\Exception\HttpException;
class ServerErrorException extends HttpException
{
}

View file

@ -0,0 +1,18 @@
<?php
namespace PHPCensor\Exception\HttpException;
use PHPCensor\Exception\HttpException;
class ValidationException extends HttpException
{
/**
* @var integer
*/
protected $errorCode = 400;
/**
* @var string
*/
protected $statusMessage = 'Bad Request';
}