From 0a220d4d8eb1b9f1edc50189b24ceefa361e63d2 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 20 Oct 2020 23:29:50 +0200 Subject: [PATCH] Move factory classes to a subfolder --- classes/{ => Factory}/ConfigFactory.php | 10 +++++++--- classes/{ => Factory}/LocaleManagerFactory.php | 3 ++- classes/{ => Factory}/LoggerFactory.php | 2 +- classes/{ => Factory}/ViewFactory.php | 5 +++-- index.php | 8 ++++---- tests/ControllerTest.php | 2 +- tests/FrontControllerTest.php | 3 +-- tests/JsonControllerTest.php | 3 +-- tests/ViewFactoryTest.php | 2 +- 9 files changed, 21 insertions(+), 17 deletions(-) rename classes/{ => Factory}/ConfigFactory.php (76%) rename classes/{ => Factory}/LocaleManagerFactory.php (89%) rename classes/{ => Factory}/LoggerFactory.php (96%) rename classes/{ => Factory}/ViewFactory.php (94%) diff --git a/classes/ConfigFactory.php b/classes/Factory/ConfigFactory.php similarity index 76% rename from classes/ConfigFactory.php rename to classes/Factory/ConfigFactory.php index ff334e5..29cd0d7 100644 --- a/classes/ConfigFactory.php +++ b/classes/Factory/ConfigFactory.php @@ -1,7 +1,10 @@ get('request'); } - $view = new Smarty(__DIR__ . '/../templates/'); + $view = new Smarty(__DIR__ . '/../../templates/'); /** @var Uri $uri */ $uri = $request->getUri(); diff --git a/index.php b/index.php index 819ee7b..105e294 100644 --- a/index.php +++ b/index.php @@ -2,18 +2,18 @@ require_once __DIR__ . '/vendor/autoload.php'; -use Alltube\ConfigFactory; use Alltube\Controller\DownloadController; use Alltube\Controller\FrontController; use Alltube\Controller\JsonController; use Alltube\ErrorHandler; -use Alltube\LocaleManagerFactory; -use Alltube\LoggerFactory; +use Alltube\Factory\ConfigFactory; +use Alltube\Factory\LocaleManagerFactory; +use Alltube\Factory\LoggerFactory; +use Alltube\Factory\ViewFactory; use Alltube\Middleware\CspMiddleware; use Alltube\Middleware\LinkHeaderMiddleware; use Alltube\Middleware\LocaleMiddleware; use Alltube\Middleware\RouterPathMiddleware; -use Alltube\ViewFactory; use Slim\App; use Slim\Container; diff --git a/tests/ControllerTest.php b/tests/ControllerTest.php index 600345c..ab5a7df 100644 --- a/tests/ControllerTest.php +++ b/tests/ControllerTest.php @@ -11,8 +11,8 @@ use Alltube\Controller\BaseController; use Alltube\Controller\DownloadController; use Alltube\Controller\FrontController; use Alltube\Exception\ConfigException; +use Alltube\Factory\ViewFactory; use Alltube\LocaleManager; -use Alltube\ViewFactory; use Psr\Log\NullLogger; use Slim\Container; use Slim\Http\Environment; diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index dbff46b..fb270ff 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -8,7 +8,6 @@ namespace Alltube\Test; use Alltube\Controller\FrontController; use Alltube\Exception\ConfigException; -use Alltube\Exception\DependencyException; use Alltube\Library\Exception\AlltubeLibraryException; use Exception; use Slim\Http\Environment; @@ -28,7 +27,7 @@ class FrontControllerTest extends ControllerTest /** * Prepare tests. - * @throws ConfigException|SmartyException|DependencyException + * @throws ConfigException|SmartyException */ protected function setUp(): void { diff --git a/tests/JsonControllerTest.php b/tests/JsonControllerTest.php index 1c3d254..438b482 100644 --- a/tests/JsonControllerTest.php +++ b/tests/JsonControllerTest.php @@ -8,7 +8,6 @@ namespace Alltube\Test; use Alltube\Controller\JsonController; use Alltube\Exception\ConfigException; -use Alltube\Exception\DependencyException; use Alltube\Library\Exception\YoutubedlException; use SmartyException; @@ -19,7 +18,7 @@ class JsonControllerTest extends ControllerTest { /** * Prepare tests. - * @throws ConfigException|SmartyException|DependencyException + * @throws ConfigException|SmartyException */ protected function setUp(): void { diff --git a/tests/ViewFactoryTest.php b/tests/ViewFactoryTest.php index 5f04a31..9237bb3 100644 --- a/tests/ViewFactoryTest.php +++ b/tests/ViewFactoryTest.php @@ -6,8 +6,8 @@ namespace Alltube\Test; +use Alltube\Factory\ViewFactory; use Alltube\LocaleManager; -use Alltube\ViewFactory; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request;