Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Pop PHP Framework (http://www.popphp.org/)
4 *
5 * @link       https://github.com/popphp/popphp-framework
6 * @author     Nick Sagona, III <dev@nolainteractive.com>
7 * @copyright  Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)
8 * @license    http://www.popphp.org/license     New BSD License
9 */
10
11/**
12 * @namespace
13 */
14namespace Pop\Router\Match;
15
16/**
17 * Pop router match interface
18 *
19 * @category   Pop
20 * @package    Pop\Router
21 * @author     Nick Sagona, III <dev@nolainteractive.com>
22 * @copyright  Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)
23 * @license    http://www.popphp.org/license     New BSD License
24 * @version    4.2.0
25 */
26interface MatchInterface
27{
28
29    /**
30     * Add a route
31     *
32     * @param  string $route
33     * @param  mixed  $controller
34     * @return MatchInterface
35     */
36    public function addRoute(string $route, mixed $controller): MatchInterface;
37
38    /**
39     * Add multiple controller routes
40     *
41     * @param  array $routes
42     * @return MatchInterface
43     */
44    public function addRoutes(array $routes): MatchInterface;
45
46    /**
47     * Add controller params to be passed into a new controller instance
48     *
49     * @param  string $controller
50     * @param  mixed  $params
51     * @return MatchInterface
52     */
53    public function addControllerParams(string $controller, mixed $params): MatchInterface;
54
55    /**
56     * Append controller params to be passed into a new controller instance
57     *
58     * @param  string $controller
59     * @param  mixed  $params
60     * @return MatchInterface
61     */
62    public function appendControllerParams(string $controller, mixed $params): MatchInterface;
63
64    /**
65     * Get the params assigned to the controller
66     *
67     * @param  string $controller
68     * @return mixed
69     */
70    public function getControllerParams(string $controller): mixed;
71
72    /**
73     * Determine if the controller has params
74     *
75     * @param  string $controller
76     * @return bool
77     */
78    public function hasControllerParams(string $controller): bool;
79
80    /**
81     * Remove controller params
82     *
83     * @param  string $controller
84     * @return MatchInterface
85     */
86    public function removeControllerParams(string $controller): MatchInterface;
87
88    /**
89     * Get the route string
90     *
91     * @return string
92     */
93    public function getRouteString(): string;
94
95    /**
96     * Get the route string segments
97     *
98     * @return array
99     */
100    public function getSegments(): array;
101
102    /**
103     * Get a route string segment
104     *
105     * @param  int $i
106     * @return ?string
107     */
108    public function getSegment(int $i): ?string;
109
110    /**
111     * Get original route string
112     *
113     * @return ?string
114     */
115    public function getOriginalRoute(): ?string;
116
117    /**
118     * Get route string
119     *
120     * @return string
121     */
122    public function getRoute(): string;
123
124    /**
125     * Get routes
126     *
127     * @return array
128     */
129    public function getRoutes(): array;
130
131    /**
132     * Get prepared routes
133     *
134     * @return array
135     */
136    public function getPreparedRoutes(): array;
137
138    /**
139     * Get flattened routes
140     *
141     * @return array
142     */
143    public function getFlattenedRoutes(): array;
144
145    /**
146     * Determine if there is a route match
147     *
148     * @return bool
149     */
150    public function hasRoute(): bool;
151
152    /**
153     * Get the params discovered from the route
154     *
155     * @return array
156     */
157    public function getRouteParams(): array;
158
159    /**
160     * Determine if the route has params
161     *
162     * @return bool
163     */
164    public function hasRouteParams(): bool;
165
166    /**
167     * Get the default route
168     *
169     * @return array
170     */
171    public function getDefaultRoute(): array;
172
173    /**
174     * Determine if there is a default route
175     *
176     * @return bool
177     */
178    public function hasDefaultRoute(): bool;
179
180    /**
181     * Get the dynamic route
182     *
183     * @return mixed
184     */
185    public function getDynamicRoute(): mixed;
186
187    /**
188     * Get the dynamic route prefix
189     *
190     * @return mixed
191     */
192    public function getDynamicRoutePrefix(): mixed;
193
194    /**
195     * Determine if there is a dynamic route
196     *
197     * @return bool
198     */
199    public function hasDynamicRoute(): bool;
200
201    /**
202     * Determine if it is a dynamic route
203     *
204     * @return bool
205     */
206    public function isDynamicRoute(): bool;
207
208    /**
209     * Get the controller
210     *
211     * @return mixed
212     */
213    public function getController(): mixed;
214
215    /**
216     * Determine if there is a controller
217     *
218     * @return bool
219     */
220    public function hasController(): bool;
221
222    /**
223     * Get the action
224     *
225     * @return mixed
226     */
227    public function getAction(): mixed;
228
229    /**
230     * Determine if there is an action
231     *
232     * @return bool
233     */
234    public function hasAction(): bool;
235
236    /**
237     * Match the route
238     *
239     * @return MatchInterface
240     */
241    public function prepare(): MatchInterface;
242
243    /**
244     * Prepare the routes
245     *
246     * @param  mixed $forceRoute
247     * @return bool
248     */
249    public function match(mixed $forceRoute = null): bool;
250
251    /**
252     * Method to process if a route was not found
253     *
254     * @param  bool $exit
255     * @return void
256     */
257    public function noRouteFound(bool $exit = true): void;
258
259}