1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00
kanboard_ynh/sources/app/Core/Controller/BaseMiddleware.php
2016-07-23 14:11:39 +02:00

58 lines
1.1 KiB
PHP

<?php
namespace Kanboard\Core\Controller;
use Kanboard\Core\Base;
/**
* Class BaseMiddleware
*
* @package Kanboard\Core\Controller
* @author Frederic Guillot
*/
abstract class BaseMiddleware extends Base
{
/**
* @var BaseMiddleware
*/
protected $nextMiddleware = null;
/**
* Execute middleware
*/
abstract public function execute();
/**
* Set next middleware
*
* @param BaseMiddleware $nextMiddleware
* @return BaseMiddleware
*/
public function setNextMiddleware(BaseMiddleware $nextMiddleware)
{
$this->nextMiddleware = $nextMiddleware;
return $this;
}
/**
* @return BaseMiddleware
*/
public function getNextMiddleware()
{
return $this->nextMiddleware;
}
/**
* Move to next middleware
*/
public function next()
{
if ($this->nextMiddleware !== null) {
if (DEBUG) {
$this->logger->debug(__METHOD__.' => ' . get_class($this->nextMiddleware));
}
$this->nextMiddleware->execute();
}
}
}