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