Refactoring: added controlled middleware and changed response class
This commit is contained in:
52
app/Core/Controller/BaseException.php
Normal file
52
app/Core/Controller/BaseException.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Kanboard\Core\Controller;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class AccessForbiddenException
|
||||
*
|
||||
* @package Kanboard\Core\Controller
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class BaseException extends Exception
|
||||
{
|
||||
protected $withoutLayout = false;
|
||||
|
||||
/**
|
||||
* Get object instance
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $message
|
||||
* @return static
|
||||
*/
|
||||
public static function getInstance($message = '')
|
||||
{
|
||||
return new static($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* There is no layout
|
||||
*
|
||||
* @access public
|
||||
* @return BaseException
|
||||
*/
|
||||
public function withoutLayout()
|
||||
{
|
||||
$this->withoutLayout = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if no layout
|
||||
*
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasLayout()
|
||||
{
|
||||
return $this->withoutLayout;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user