Basic functionality

This commit is contained in:
2022-03-12 16:25:30 +01:00
parent f3beaa64cf
commit acc21b7b24
137 changed files with 12647 additions and 5089 deletions

View File

@@ -0,0 +1,64 @@
<?php declare(strict_types = 1);
namespace App\Model\Router;
use Nette\Application\Routers\Route;
use Nette\Application\Routers\RouteList;
use Nette\Routing\RouteList as RoutingRouteList;
final class RouterFactory
{
public function create(): RouteList
{
$router = new RouteList();
$this->buildApi($router);
$this->buildMailing($router);
$this->buildPdf($router);
$this->buildAdmin($router);
$this->buildFront($router);
return $router;
}
protected function buildAdmin(RouteList $router): RouteList
{
$router[] = $list = new RouteList('Admin');
$list[] = new Route('admin/<presenter>/<action>[/<id>]', 'Home:default');
return $router;
}
protected function buildFront(RouteList $router): RouteList
{
$router[] = $list = new RouteList('Front');
$list[] = new Route('<presenter>/<action>[/<id>]', 'Home:default');
return $router;
}
protected function buildMailing(RouteList $router): RouteList
{
$router[] = $list = new RouteList('Mailing');
$list[] = new Route('mailing/<presenter>/<action>[/<id>]', 'Home:default');
return $router;
}
protected function buildPdf(RouteList $router): RouteList
{
$router[] = $list = new RouteList('Pdf');
$list[] = new Route('pdf/<presenter>/<action>[/<id>]', 'Home:default');
return $router;
}
protected function buildApi(RouteList $router): RouteList
{
$router[] = $list = new RouteList('Api');
$list[] = new Route('/api/v<version>/<package>[/<apiAction>][/<params>]', 'Api:default');
return $router;
}
}