2022-09-13 13:13:11 +00:00
|
|
|
<?php
|
|
|
|
// index.php
|
|
|
|
// Created: 2021-04-26
|
2023-07-21 18:04:29 +00:00
|
|
|
// Updated: 2023-07-21
|
2022-09-13 13:13:11 +00:00
|
|
|
|
|
|
|
namespace Index;
|
|
|
|
|
|
|
|
define('NDX_ROOT', __DIR__);
|
|
|
|
define('NDX_DIR_SRC', NDX_ROOT . DIRECTORY_SEPARATOR . 'src');
|
|
|
|
|
2023-07-21 18:04:29 +00:00
|
|
|
// Only initialise the autoloader if Composer's autoloader doesn't exist yet
|
|
|
|
if(!class_exists(\Composer\Autoload\ClassLoader::class)) {
|
|
|
|
require_once NDX_DIR_SRC . DIRECTORY_SEPARATOR . 'Autoloader.php';
|
2022-09-13 13:13:11 +00:00
|
|
|
|
2023-07-21 18:04:29 +00:00
|
|
|
Autoloader::addNamespace(__NAMESPACE__, NDX_DIR_SRC);
|
|
|
|
Autoloader::register();
|
|
|
|
}
|
2022-09-13 13:13:11 +00:00
|
|
|
|
|
|
|
// currently phpstan sucks and relies on error suppression, luckily it leaves a constant!
|
|
|
|
if(!defined('__PHPSTAN_RUNNING__')) {
|
|
|
|
// defining this WILL cause issues, never do it unless you HAVE to
|
|
|
|
if(!defined('NDX_LEAVE_ERRORS'))
|
|
|
|
Exceptions::convertErrors();
|
|
|
|
|
|
|
|
if(!defined('NDX_LEAVE_EXCEPTIONS'))
|
|
|
|
Exceptions::handleExceptions();
|
|
|
|
}
|