Классы внутри vendor подтягиваются из внутренней директории src.
This commit is contained in:
parent
4470f80098
commit
60ac124ea9
@ -10,13 +10,18 @@ require_once 'mysql_override.php';
|
|||||||
|
|
||||||
spl_autoload_register(function (string $className) {
|
spl_autoload_register(function (string $className) {
|
||||||
$rootdir = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '_incl_data' . DIRECTORY_SEPARATOR;
|
$rootdir = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . '_incl_data' . DIRECTORY_SEPARATOR;
|
||||||
|
$addsrc = function ($class) {
|
||||||
|
$c = explode('\\', $class);
|
||||||
|
array_splice($c, 1, 0, 'src');
|
||||||
|
return implode(DIRECTORY_SEPARATOR, $c);
|
||||||
|
};
|
||||||
# 1 with namespaces
|
# 1 with namespaces
|
||||||
# 2 without
|
# 2 without
|
||||||
$fileName = [
|
$fileName = [
|
||||||
$rootdir . 'class' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
$rootdir . 'class' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
||||||
$rootdir . 'class' . DIRECTORY_SEPARATOR . $className . '.php',
|
$rootdir . 'class' . DIRECTORY_SEPARATOR . $className . '.php',
|
||||||
$rootdir . 'function' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
$rootdir . 'function' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
||||||
$rootdir . 'vendor' . DIRECTORY_SEPARATOR . $className . '.php',
|
$rootdir . 'vendor' . DIRECTORY_SEPARATOR . $addsrc($className) . '.php',
|
||||||
];
|
];
|
||||||
foreach ($fileName as $file) {
|
foreach ($fileName as $file) {
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user