blob: f2862d13ce40e6e80b59805228612c809bde4770 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<?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($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();
}
}
}
|