Move factory classes to a subfolder

This commit is contained in:
Pierre Rudloff 2020-10-20 23:29:50 +02:00
parent 123a6c5ad9
commit 0a220d4d8e
9 changed files with 21 additions and 17 deletions

View file

@ -1,7 +1,10 @@
<?php
namespace Alltube;
namespace Alltube\Factory;
use Alltube\Config;
use Alltube\Exception\ConfigException;
use Alltube\UglyRouter;
use Slim\Container;
use Symfony\Component\ErrorHandler\Debug;
@ -13,12 +16,13 @@ class ConfigFactory
{
/**
* @param Container $container
* @return Config
* @throws Exception\ConfigException
* @throws ConfigException
*/
public static function create(Container $container)
{
$configPath = __DIR__ . '/../config/config.yml';
$configPath = __DIR__ . '/../../config/config.yml';
if (is_file($configPath)) {
$config = Config::fromFile($configPath);
} else {

View file

@ -1,8 +1,9 @@
<?php
namespace Alltube;
namespace Alltube\Factory;
use Alltube\Exception\DependencyException;
use Alltube\LocaleManager;
/**
* Class LocaleManagerFactory

View file

@ -1,6 +1,6 @@
<?php
namespace Alltube;
namespace Alltube\Factory;
use Consolidation\Log\Logger;
use Consolidation\Log\LogOutputStyler;

View file

@ -4,8 +4,9 @@
* ViewFactory class.
*/
namespace Alltube;
namespace Alltube\Factory;
use Alltube\LocaleManager;
use Psr\Container\ContainerInterface;
use Slim\Http\Request;
use Slim\Http\Uri;
@ -33,7 +34,7 @@ class ViewFactory
$request = $container->get('request');
}
$view = new Smarty(__DIR__ . '/../templates/');
$view = new Smarty(__DIR__ . '/../../templates/');
/** @var Uri $uri */
$uri = $request->getUri();

View file

@ -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;

View file

@ -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;

View file

@ -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
{

View file

@ -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
{

View file

@ -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;