Minor refactor of bootstrap setup
This commit is contained in:
parent
5c382db49c
commit
c7a75dd2b4
@ -19,9 +19,12 @@ namespace Aviat\AnimeClient;
|
|||||||
use Aura\Html\HelperLocatorFactory;
|
use Aura\Html\HelperLocatorFactory;
|
||||||
use Aura\Router\RouterContainer;
|
use Aura\Router\RouterContainer;
|
||||||
use Aura\Session\SessionFactory;
|
use Aura\Session\SessionFactory;
|
||||||
use Aviat\AnimeClient\API\{Kitsu, MAL};
|
use Aviat\AnimeClient\API\{
|
||||||
use Aviat\AnimeClient\API\Kitsu\KitsuRequestBuilder;
|
Kitsu,
|
||||||
use Aviat\AnimeClient\API\MAL\MALRequestBuilder;
|
MAL,
|
||||||
|
Kitsu\KitsuRequestBuilder,
|
||||||
|
MAL\MALRequestBuilder
|
||||||
|
};
|
||||||
use Aviat\AnimeClient\Model;
|
use Aviat\AnimeClient\Model;
|
||||||
use Aviat\Banker\Pool;
|
use Aviat\Banker\Pool;
|
||||||
use Aviat\Ion\Config;
|
use Aviat\Ion\Config;
|
||||||
@ -33,30 +36,30 @@ use Zend\Diactoros\{Response, ServerRequestFactory};
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Setup DI container
|
// Setup DI container
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
return function(array $config_array = []) {
|
return function(array $configArray = []) {
|
||||||
$container = new Container();
|
$container = new Container();
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// Logging
|
// Logging
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
$app_logger = new Logger('animeclient');
|
$appLogger = new Logger('animeclient');
|
||||||
$app_logger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/app.log', Logger::NOTICE));
|
$appLogger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/app.log', Logger::NOTICE));
|
||||||
$kitsu_request_logger = new Logger('kitsu-request');
|
$kitsuRequestLogger = new Logger('kitsu-request');
|
||||||
$kitsu_request_logger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/kitsu_request.log', Logger::NOTICE));
|
$kitsuRequestLogger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/kitsu_request.log', Logger::NOTICE));
|
||||||
$mal_request_logger = new Logger('mal-request');
|
$malRequestLogger = new Logger('mal-request');
|
||||||
$mal_request_logger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/mal_request.log', Logger::NOTICE));
|
$malRequestLogger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/mal_request.log', Logger::NOTICE));
|
||||||
$container->setLogger($app_logger, 'default');
|
$container->setLogger($appLogger, 'default');
|
||||||
$container->setLogger($kitsu_request_logger, 'kitsu-request');
|
$container->setLogger($kitsuRequestLogger, 'kitsu-request');
|
||||||
$container->setLogger($mal_request_logger, 'mal-request');
|
$container->setLogger($malRequestLogger, 'mal-request');
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// Injected Objects
|
// Injected Objects
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
// Create Config Object
|
// Create Config Object
|
||||||
$container->set('config', function() use ($config_array) {
|
$container->set('config', function() use ($configArray) {
|
||||||
return new Config($config_array);
|
return new Config($configArray);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create Cache Object
|
// Create Cache Object
|
||||||
@ -73,14 +76,14 @@ return function(array $config_array = []) {
|
|||||||
|
|
||||||
// Create Html helper Object
|
// Create Html helper Object
|
||||||
$container->set('html-helper', function($container) {
|
$container->set('html-helper', function($container) {
|
||||||
$html_helper = (new HelperLocatorFactory)->newInstance();
|
$htmlHelper = (new HelperLocatorFactory)->newInstance();
|
||||||
$html_helper->set('menu', function() use ($container) {
|
$htmlHelper->set('menu', function() use ($container) {
|
||||||
$menu_helper = new Helper\Menu();
|
$menuHelper = new Helper\Menu();
|
||||||
$menu_helper->setContainer($container);
|
$menuHelper->setContainer($container);
|
||||||
return $menu_helper;
|
return $menuHelper;
|
||||||
});
|
});
|
||||||
|
|
||||||
return $html_helper;
|
return $htmlHelper;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create Request/Response Objects
|
// Create Request/Response Objects
|
||||||
|
Loading…
Reference in New Issue
Block a user