Refactored HttpExceptions.
This commit is contained in:
parent
69e969436d
commit
aadfabd714
27 changed files with 54 additions and 57 deletions
40
src/PHPCensor/Exception/HttpException.php
Normal file
40
src/PHPCensor/Exception/HttpException.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue