1 | <?php |
||
11 | class Router |
||
12 | { |
||
13 | /** @var \Opis\Pattern\RegexBuilder */ |
||
14 | protected $builder; |
||
15 | |||
16 | /** @var array */ |
||
17 | protected $routes = []; |
||
18 | |||
19 | /** @var \LBHurtado\Missive\Missive */ |
||
20 | public $missive; |
||
21 | |||
22 | /** @var ContainerInterface */ |
||
23 | protected $container; |
||
24 | |||
25 | /** |
||
26 | * Router constructor. |
||
27 | * Capture the Missive instance from the container. |
||
28 | * Instantiate RegexBuilder that ignores casing. |
||
29 | * @param Missive $missive |
||
30 | */ |
||
31 | public function __construct(Missive $missive) |
||
39 | |||
40 | /** |
||
41 | * @param string $route |
||
42 | * @param string|callable $action |
||
43 | * @return Router |
||
44 | */ |
||
45 | public function register(string $route, $action): self |
||
53 | |||
54 | /** |
||
55 | * Sets the SMS property of Missive before |
||
56 | * executing the contents of them sms |
||
57 | * @param SMSAbstract $sms |
||
58 | * @return mixed |
||
59 | */ |
||
60 | public function process(SMSAbstract $sms) |
||
66 | |||
67 | /** |
||
68 | * @param string $path |
||
69 | * @return mixed |
||
70 | */ |
||
71 | public function execute(string $path) |
||
88 | |||
89 | /** |
||
90 | * Make an action for an invokable controller. |
||
91 | * |
||
92 | * @param string $action |
||
93 | * @return string |
||
94 | * @throws UnexpectedValueException |
||
95 | */ |
||
96 | protected function makeInvokableAction($action) |
||
106 | |||
107 | /** |
||
108 | * @param $callback |
||
109 | * @return array|string|Closure |
||
110 | * @throws UnexpectedValueException |
||
111 | * @throws NotFoundExceptionInterface |
||
112 | */ |
||
113 | protected function getCallable($callback) |
||
137 | |||
138 | /** |
||
139 | * @param ContainerInterface $container |
||
140 | */ |
||
141 | public function setContainer(ContainerInterface $container) |
||
145 | } |
||
146 |