2017-09-15 14:36:37 +03:00
|
|
|
<?php
|
2016-07-09 13:25:21 +03:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Easy!Appointments - Open Source Web Scheduler
|
|
|
|
*
|
|
|
|
* @package EasyAppointments
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
2020-03-11 12:10:59 +03:00
|
|
|
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
2016-07-09 13:25:21 +03:00
|
|
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
|
|
|
* @link http://easyappointments.org
|
|
|
|
* @since v1.2.0
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
2017-09-15 14:36:37 +03:00
|
|
|
namespace EA\Engine\Api\V1;
|
2016-07-09 13:25:21 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* API v1 Exception Class
|
|
|
|
*
|
2017-09-15 14:36:37 +03:00
|
|
|
* This exception variation will hold the information needed for exception handling in the API.
|
2016-07-09 13:25:21 +03:00
|
|
|
*/
|
|
|
|
class Exception extends \Exception {
|
|
|
|
/**
|
2017-09-15 14:36:37 +03:00
|
|
|
* Header Description
|
2016-07-09 13:25:21 +03:00
|
|
|
*
|
|
|
|
* e.g. 'Unauthorized'
|
2017-09-15 14:36:37 +03:00
|
|
|
*
|
2016-07-09 13:25:21 +03:00
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $header;
|
|
|
|
|
|
|
|
/**
|
2017-09-15 14:36:37 +03:00
|
|
|
* Class Constructor
|
2016-07-09 13:25:21 +03:00
|
|
|
*
|
|
|
|
* @link http://php.net/manual/en/class.exception.php
|
2017-09-15 14:36:37 +03:00
|
|
|
*
|
|
|
|
* @param string $message
|
2016-07-09 13:25:21 +03:00
|
|
|
* @param int $code
|
2017-09-15 14:36:37 +03:00
|
|
|
* @param string $header
|
|
|
|
* @param \Exception|null $previous
|
2016-07-09 13:25:21 +03:00
|
|
|
*/
|
2017-09-15 14:36:37 +03:00
|
|
|
public function __construct($message = NULL, $code = 500, $header = '', \Exception $previous = NULL)
|
|
|
|
{
|
2016-07-09 13:25:21 +03:00
|
|
|
parent::__construct($message, $code, $previous);
|
|
|
|
$this->header = $header;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-09-15 14:36:37 +03:00
|
|
|
* Get the header string.
|
|
|
|
*
|
2016-07-09 13:25:21 +03:00
|
|
|
* @return string
|
|
|
|
*/
|
2017-09-15 14:36:37 +03:00
|
|
|
public function getHeader()
|
|
|
|
{
|
2016-07-09 13:25:21 +03:00
|
|
|
return $this->header;
|
|
|
|
}
|
|
|
|
}
|