From 10a861b14bb57ccd2950b12e381972c4421c72d9 Mon Sep 17 00:00:00 2001 From: Benoit Foujols Date: Fri, 29 Dec 2023 10:24:18 +0100 Subject: [PATCH] #43 Fix concention code --- .../Commands/CreateControllerCommand.php | 20 +++++++------- .../Core/View/StudooDebugExtension.php | 27 ++++++++++++++----- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/EduFramework/Commands/CreateControllerCommand.php b/src/EduFramework/Commands/CreateControllerCommand.php index e651dd6..bd9fd94 100644 --- a/src/EduFramework/Commands/CreateControllerCommand.php +++ b/src/EduFramework/Commands/CreateControllerCommand.php @@ -74,16 +74,16 @@ private function getNamesCollection(string $arg): array $uri = "/".strtolower($arg); $twig = strtolower($arg); - if(count($pieces)>1) { + if(count($pieces) > 1) { $twig = implode("_", array_map(function ($item) {return strtolower($item);}, $pieces)); $uri = str_replace("_", "-", $twig); } return [ - "uri"=>$uri, - "twigDir"=>$twig, - "twigPath"=>"$twig/$twig.html.twig", - "className"=>$className + "uri" => $uri, + "twigDir" => $twig, + "twigPath" => "$twig/$twig.html.twig", + "className" => $className ]; } @@ -104,7 +104,7 @@ private function generateController(string $className, string $twigPath): void $file = new PhpFile(); //Add namespace Controller - $namespace= $file->addNamespace("Controller"); + $namespace = $file->addNamespace("Controller"); //Add Imports $namespace->addUse('Studoo\EduFramework\Core\Controller\ControllerInterface'); $namespace->addUse('Studoo\EduFramework\Core\Controller\Request'); @@ -150,10 +150,10 @@ private function generateRoute(string $name, string $uri, string $className): vo throw new RouteAlreadyExistsException(); } - $router[$name]=[ - "uri"=>"/".$uri, - "controller"=>'Controller\\'.$className, - "httpMethod"=>["GET"] + $router[$name] = [ + "uri" => "/".$uri, + "controller" => 'Controller\\'.$className, + "httpMethod" => ["GET"] ]; file_put_contents(self::ROUTES_FILE_PATH, Yaml::dump($router)); diff --git a/src/EduFramework/Core/View/StudooDebugExtension.php b/src/EduFramework/Core/View/StudooDebugExtension.php index 59e41df..1c4a076 100644 --- a/src/EduFramework/Core/View/StudooDebugExtension.php +++ b/src/EduFramework/Core/View/StudooDebugExtension.php @@ -1,20 +1,28 @@
{$result}
"; + echo "
+
{$result}
+
"; } -} \ No newline at end of file +}