-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractMiddleware.php
More file actions
52 lines (46 loc) · 1.02 KB
/
AbstractMiddleware.php
File metadata and controls
52 lines (46 loc) · 1.02 KB
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
<?php declare(strict_types=1);
/**
* Part of Windwalker project.
*
* @copyright Copyright (C) 2019 LYRASOFT.
* @license LGPL-2.0-or-later
*/
namespace Windwalker\Middleware;
/**
* Basic Middleware class.
*
* @since 2.0
*/
abstract class AbstractMiddleware implements MiddlewareInterface
{
/**
* THe next middleware.
*
* @var mixed|MiddlewareInterface
*/
protected $next = null;
/**
* Get next middleware.
*
* @return mixed|MiddlewareInterface
*/
public function getNext()
{
return $this->next;
}
/**
* Set next middleware.
*
* @param callable|MiddlewareInterface $callable The middleware object.
*
* @return static Return self to support chaining.
*/
public function setNext($callable)
{
if (!($callable instanceof MiddlewareInterface) && is_callable($callable)) {
$callable = new CallbackMiddleware($callable);
}
$this->next = $callable;
return $this;
}
}