Files
szurubooru/src/RouteRepository.php
2014-11-21 10:23:49 +01:00

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']);
}
}
}
}