Skip to content

Commit

Permalink
Merge static controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
Programie committed Oct 5, 2023
1 parent 36b1469 commit 4018a25
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 57 deletions.
10 changes: 4 additions & 6 deletions httpdocs/index.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
use com\selfcoders\website\controller\AboutController;
use com\selfcoders\website\controller\HomeController;
use com\selfcoders\website\controller\ImprintController;
use com\selfcoders\website\controller\PrivacyPolicyController;
use com\selfcoders\website\controller\StaticController;
use com\selfcoders\website\controller\ProjectsController;
use com\selfcoders\website\exception\ForbiddenException;
use com\selfcoders\website\exception\NotFoundException;
Expand All @@ -25,10 +23,10 @@
"noslash" => "[^/]+"
]);

$router->map("GET", "/", [HomeController::class, "getContent"]);
$router->map("GET", "/", [StaticController::class, "getHome"]);
$router->map("GET", "/about", [AboutController::class, "getContent"]);
$router->map("GET", "/imprint", [ImprintController::class, "getContent"]);
$router->map("GET", "/privacy-policy", [PrivacyPolicyController::class, "getContent"]);
$router->map("GET", "/imprint", [StaticController::class, "getImprint"]);
$router->map("GET", "/privacy-policy", [StaticController::class, "getPrivacyPolicy"]);
$router->map("GET", "/projects", [ProjectsController::class, "listProjects"]);
$router->map("GET", "/projects/[applications|minecraft-plugins|php-libraries:category]", [ProjectsController::class, "listProjectsOfCategory"]);
$router->map("GET", "/projects/[noslash:name]", [ProjectsController::class, "redirectToRepoReadme"]);
Expand Down
17 changes: 0 additions & 17 deletions src/main/php/com/selfcoders/website/controller/HomeController.php

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
namespace com\selfcoders\website\controller;

use com\selfcoders\website\TwigRenderer;
use Twig\Error\Error as TwigError;

class StaticController extends AbstractController
{
/**
* @return string
* @throws TwigError
*/
public function getHome(): string
{
return TwigRenderer::render("home");
}

/**
* @return string
* @throws TwigError
*/
public function getImprint(): string
{
return TwigRenderer::render("imprint");
}

/**
* @return string
* @throws TwigError
*/
public function getPrivacyPolicy(): string
{
return TwigRenderer::render("privacy-policy");
}
}

0 comments on commit 4018a25

Please sign in to comment.