2017-03-30 16:49:48 -04:00
|
|
|
<?php declare(strict_types=1);
|
2015-06-16 11:11:35 -04:00
|
|
|
/**
|
2017-03-30 16:49:48 -04:00
|
|
|
* Hummingbird Anime List Client
|
2015-11-16 11:40:01 -05:00
|
|
|
*
|
2017-03-30 16:49:48 -04:00
|
|
|
* An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
|
2015-11-16 11:40:01 -05:00
|
|
|
*
|
2017-03-30 16:49:48 -04:00
|
|
|
* PHP version 7
|
2016-08-30 10:57:41 -04:00
|
|
|
*
|
2015-11-16 11:40:01 -05:00
|
|
|
* @package HummingbirdAnimeClient
|
2016-08-30 10:57:41 -04:00
|
|
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
2018-01-15 14:43:15 -05:00
|
|
|
* @copyright 2015 - 2018 Timothy J. Warren
|
2016-08-30 10:57:41 -04:00
|
|
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
2017-03-30 16:49:48 -04:00
|
|
|
* @version 4.0
|
|
|
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
2015-06-16 11:11:35 -04:00
|
|
|
*/
|
2017-03-30 16:49:48 -04:00
|
|
|
|
2016-12-20 12:58:37 -05:00
|
|
|
namespace Aviat\AnimeClient;
|
|
|
|
|
2017-03-30 16:57:58 -04:00
|
|
|
use function Aviat\Ion\_dir;
|
2015-10-09 14:34:55 -04:00
|
|
|
|
2015-06-25 17:00:29 -04:00
|
|
|
// Work around the silly timezone error
|
|
|
|
$timezone = ini_get('date.timezone');
|
|
|
|
if ($timezone === '' || $timezone === FALSE)
|
|
|
|
{
|
|
|
|
ini_set('date.timezone', 'GMT');
|
|
|
|
}
|
2015-06-11 16:44:52 -04:00
|
|
|
|
2017-02-22 15:08:29 -05:00
|
|
|
// Load composer autoloader
|
2017-12-06 14:40:13 -05:00
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
2015-09-14 10:54:50 -04:00
|
|
|
|
2017-12-08 22:32:00 -05:00
|
|
|
$whoops = new \Whoops\Run;
|
|
|
|
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
|
|
|
|
$whoops->register();
|
|
|
|
|
2016-01-06 15:44:40 -05:00
|
|
|
// Define base directories
|
|
|
|
$APP_DIR = _dir(__DIR__, 'app');
|
2017-02-10 15:50:07 -05:00
|
|
|
$APPCONF_DIR = _dir($APP_DIR, 'appConf');
|
2016-01-06 15:44:40 -05:00
|
|
|
$CONF_DIR = _dir($APP_DIR, 'config');
|
|
|
|
|
2015-10-09 14:34:55 -04:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Dependency Injection setup
|
|
|
|
// -----------------------------------------------------------------------------
|
2018-01-16 14:58:07 -05:00
|
|
|
$base_config = require $APPCONF_DIR . '/base_config.php';
|
2018-01-18 16:21:45 -05:00
|
|
|
$di = require $APP_DIR . '/bootstrap.php';
|
2016-01-06 15:44:40 -05:00
|
|
|
|
2017-02-08 15:48:20 -05:00
|
|
|
$config = loadToml($CONF_DIR);
|
2016-02-10 17:30:45 -05:00
|
|
|
$config_array = array_merge($base_config, $config);
|
|
|
|
|
|
|
|
$container = $di($config_array);
|
|
|
|
|
2016-01-06 15:44:40 -05:00
|
|
|
// Unset 'constants'
|
2017-12-06 14:40:13 -05:00
|
|
|
unset($APP_DIR, $APPCONF_DIR);
|
2016-01-06 15:44:40 -05:00
|
|
|
|
2015-10-09 14:34:55 -04:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Dispatch to the current route
|
|
|
|
// -----------------------------------------------------------------------------
|
2017-12-06 14:40:13 -05:00
|
|
|
$container->get('dispatcher')();
|