Version 5.1 - All the GraphQL #32
@ -4,12 +4,12 @@
|
||||
"license":"MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Aviat\\Ion\\": "src/"
|
||||
"Aviat\\AnimeClient\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Aviat\\Ion\\Tests\\": "tests/",
|
||||
"Aviat\\AnimeClient\\Tests\\": "tests/",
|
||||
"CodeIgniter\\": "build/CodeIgniter/"
|
||||
}
|
||||
},
|
||||
|
21
index.php
21
index.php
@ -34,27 +34,9 @@ function _dir()
|
||||
|
||||
// Define base directories
|
||||
$APP_DIR = _dir(__DIR__, 'app');
|
||||
$SRC_DIR = _dir(__DIR__, 'src');
|
||||
$CONF_DIR = _dir($APP_DIR, 'config');
|
||||
|
||||
/**
|
||||
* Set up autoloaders
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return void
|
||||
*/
|
||||
spl_autoload_register(function($class) use ($SRC_DIR) {
|
||||
$class_parts = explode('\\', $class);
|
||||
$ns_path = $SRC_DIR . '/' . implode('/', $class_parts) . ".php";
|
||||
|
||||
if (file_exists($ns_path))
|
||||
{
|
||||
require_once($ns_path);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
// Set up autoloader for third-party dependencies
|
||||
// Load composer autoloader
|
||||
require _dir(__DIR__, '/vendor/autoload.php');
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
@ -86,7 +68,6 @@ $container = $di($config_array);
|
||||
|
||||
// Unset 'constants'
|
||||
unset($APP_DIR);
|
||||
unset($SRC_DIR);
|
||||
unset($CONF_DIR);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -15,7 +15,7 @@ namespace Aviat\AnimeClient;
|
||||
|
||||
use Yosymfony\Toml\Toml;
|
||||
|
||||
define('SRC_DIR', realpath(__DIR__ . '/../../'));
|
||||
define('SRC_DIR', realpath(__DIR__));
|
||||
|
||||
/**
|
||||
* Application constants
|
@ -53,7 +53,7 @@ class BaseCommand extends Command {
|
||||
*/
|
||||
protected function setupContainer()
|
||||
{
|
||||
$CONF_DIR = realpath(__DIR__ . '/../../../../app/config/');
|
||||
$CONF_DIR = realpath(__DIR__ . '/../../app/config/');
|
||||
require_once $CONF_DIR . '/base_config.php'; // $base_config
|
||||
|
||||
$config = AnimeClient::load_toml($CONF_DIR);
|
@ -12,9 +12,6 @@
|
||||
*/
|
||||
namespace Aviat\AnimeClient;
|
||||
|
||||
use Aura\Web\Request;
|
||||
use Aura\Web\Response;
|
||||
|
||||
use Aviat\Ion\Di\ContainerInterface;
|
||||
use Aviat\Ion\Friend;
|
||||
|
||||
@ -38,7 +35,7 @@ class Dispatcher extends RoutingBase {
|
||||
|
||||
/**
|
||||
* Class wrapper for input superglobals
|
||||
* @var object
|
||||
* @var Psr\Http\Message\ServerRequestInterface
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
@ -215,6 +212,7 @@ class Dispatcher extends RoutingBase {
|
||||
{
|
||||
$default_namespace = AnimeClient::DEFAULT_CONTROLLER_NAMESPACE;
|
||||
$path = str_replace('\\', '/', $default_namespace);
|
||||
$path = str_replace('Aviat/AnimeClient/', '', $path);
|
||||
$path = trim($path, '/');
|
||||
$actual_path = realpath(\_dir(AnimeClient::SRC_DIR, $path));
|
||||
$class_files = glob("{$actual_path}/*.php");
|
||||
@ -273,7 +271,7 @@ class Dispatcher extends RoutingBase {
|
||||
$params = [];
|
||||
|
||||
switch($failure->failedRule) {
|
||||
case 'Aura\Router\Rule\Alows':
|
||||
case 'Aura\Router\Rule\Allows':
|
||||
$params = [
|
||||
'http_code' => 405,
|
||||
'title' => '405 Method Not Allowed',
|
@ -31,27 +31,8 @@ function _dir()
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
require _dir(__DIR__, 'AnimeClient_TestCase.php');
|
||||
|
||||
// Define base path constants
|
||||
require _dir(__DIR__, '../vendor/autoload.php');
|
||||
|
||||
/**
|
||||
* Set up autoloaders
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return void
|
||||
*/
|
||||
spl_autoload_register(function ($class) {
|
||||
$class_parts = explode('\\', $class);
|
||||
$ns_path = realpath(__DIR__ . '/../src') . '/' . implode('/', $class_parts) . ".php";
|
||||
|
||||
if (file_exists($ns_path))
|
||||
{
|
||||
require_once($ns_path);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Ini Settings
|
||||
// -----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user