mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
30 lines
461 B
PHP
30 lines
461 B
PHP
<?php
|
|
namespace Szurubooru;
|
|
|
|
class RouteRepository
|
|
{
|
|
private $routes = [];
|
|
|
|
public function __construct(array $routes)
|
|
{
|
|
$this->routes = $routes;
|
|
}
|
|
|
|
public function getRoutes()
|
|
{
|
|
return $this->routes;
|
|
}
|
|
|
|
public function injectRoutes(Router $router)
|
|
{
|
|
foreach ($this->routes as $route)
|
|
{
|
|
foreach ($route->getMethods() as $method)
|
|
{
|
|
$method = strtolower($method);
|
|
$router->$method($route->getUrl(), [$route, 'work']);
|
|
}
|
|
}
|
|
}
|
|
}
|