-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoute.php
65 lines (58 loc) · 1.19 KB
/
Route.php
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
59
60
61
62
63
64
65
<?php declare(strict_types=1);
namespace Phact\Router;
use Psr\Http\Server\MiddlewareInterface;
class Route implements RouterHandler
{
/**
* @var mixed
*/
protected $originalHandler;
/**
* @var MiddlewareInterface[]
*/
protected $middlewares;
/**
* @var string|null
*/
private $name;
/**
* Handler constructor.
*
* @param mixed $originalHandler
* @param array $middlewares
* @param string|null $name
*/
public function __construct($originalHandler, ?string $name = null, array $middlewares = [])
{
$this->originalHandler = $originalHandler;
$this->middlewares = $middlewares;
$this->name = $name;
}
/**
* Get route original handler
*
* @return mixed
*/
public function getOriginalHandler()
{
return $this->originalHandler;
}
/**
* Get route Middlewares
*
* @return array
*/
public function getMiddlewares(): array
{
return $this->middlewares;
}
/**
* Get route name
*
* @return string|null
*/
public function getName(): ?string
{
return $this->name;
}
}