chore: lots of changes
This commit is contained in:
25
src/Framework/Router/RouteCollection.php
Normal file
25
src/Framework/Router/RouteCollection.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Framework\Router;
|
||||
|
||||
final class RouteCollection
|
||||
{
|
||||
/** @var array<string, array{static: array<string, callable>, dynamic: array<array{regex: string, handler: callable}>}> */
|
||||
private array $routes;
|
||||
|
||||
public function __construct(array $routes) {
|
||||
$this->routes = $routes;
|
||||
}
|
||||
|
||||
public function getStatic(string $method): array {
|
||||
return $this->routes[$method]['static'] ?? [];
|
||||
}
|
||||
|
||||
public function getDynamic(string $method): array {
|
||||
return $this->routes[$method]['dynamic'] ?? [];
|
||||
}
|
||||
|
||||
public function has(string $method): bool {
|
||||
return isset($this->routes[$method]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user