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

@ -0,0 +1,35 @@
<?php
namespace Alltube\Factory;
use Consolidation\Log\Logger;
use Consolidation\Log\LogOutputStyler;
use Slim\Container;
use Symfony\Component\Console\Output\ConsoleOutput;
/**
* Class LoggerFactory
* @package Alltube
*/
class LoggerFactory
{
/**
* @param Container $container
* @return Logger
*/
public static function create(Container $container)
{
$config = $container->get('config');
if ($config->debug) {
$verbosity = ConsoleOutput::VERBOSITY_DEBUG;
} else {
$verbosity = ConsoleOutput::VERBOSITY_NORMAL;
}
$logger = new Logger(new ConsoleOutput($verbosity));
$logger->setLogOutputStyler(new LogOutputStyler());
return $logger;
}
}