Comus Party 1.0.0
Application web de mini-jeux en ligne
Chargement...
Recherche...
Aucune correspondance
ControllerFactory.class.php
Aller à la documentation de ce fichier.
1<?php
9
10namespace ComusParty\Controllers;
11
12use ComusParty\App\Exceptions\ControllerNotFoundException;
13use Twig\Environment;
14use Twig\Loader\FilesystemLoader;
15
22{
31 public static function getController(string $controller, FilesystemLoader $loader, Environment $twig): Controller
32 {
33 $controllerName = 'ComusParty\Controllers\Controller' . ucfirst($controller);
34
35 if (!class_exists($controllerName)) {
36 throw new ControllerNotFoundException('Controller ' . $controllerName . ' not found');
37 }
38 return new $controllerName($loader, $twig);
39 }
40}
static getController(string $controller, FilesystemLoader $loader, Environment $twig)
La méthode getController permet de récupérer un contrôleur.
$twig
Instance de Twig.
Definition twig.php:28
$loader
Instance de FilesystemLoader.
Definition twig.php:23