-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoload.php
96 lines (87 loc) · 3.06 KB
/
autoload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* This class is used for autocomplete.
* Class _AUTOLOAD_.
*
* @noautoload it avoids to index this class
* @generated by AutoLoadOne 1.11 generated 2019/06/11 08:35:03
*
* @copyright Copyright Jorge Castro C - MIT License. https://github.com/EFTEC/AutoLoadOne
* @author Divine Niiquaye <hello@biuhub.net>
*/
const s5cff67b7d578d__debug = true;
/* @var string[] Where $_arrautoloadCustom['namespace\Class']='folder\file.php' */
const s5cff67b7d578d__arrautoloadCustom = [
];
/* @var string[] Where $_arrautoload['namespace']='folder' */
const s5cff67b7d578d__arrautoload = [
'BiuradPHP\Toolbox\ConsoleLite' => '/src',
'BiuradPHP\Toolbox\ConsoleLite\Commands' => '/src/Commands',
'BiuradPHP\Toolbox\ConsoleLite\Compile' => '/src/Compile',
'BiuradPHP\Toolbox\ConsoleLite\Concerns' => '/src/Concerns',
'BiuradPHP\Toolbox\ConsoleLite\Exceptions' => '/src/Exceptions',
'BiuradPHP\Toolbox\ConsoleLite\Interfaces' => '/src/Interfaces',
'BiuradPHP\Toolbox\ConsoleLite\Stuble' => '/src/Stuble',
];
/* @var boolean[] Where $_arrautoload['namespace' or 'namespace\Class']=true if it's absolute (it uses the full path) */
const s5cff67b7d578d__arrautoloadAbsolute = [
];
/**
* @param $class_name
*
* @throws Exception
*/
function s5cff67b7d578d__auto($class_name)
{
// its called only if the class is not loaded.
$ns = dirname($class_name); // without trailing
$ns = ($ns == '.') ? '' : $ns;
$cls = basename($class_name);
// special cases
if (isset(s5cff67b7d578d__arrautoloadCustom[$class_name])) {
s5cff67b7d578d__loadIfExists(s5cff67b7d578d__arrautoloadCustom[$class_name], $class_name);
return;
}
// normal (folder) cases
if (isset(s5cff67b7d578d__arrautoload[$ns])) {
s5cff67b7d578d__loadIfExists(s5cff67b7d578d__arrautoload[$ns].'/'.$cls.'.php', $ns);
return;
}
}
/**
* We load the file.
*
* @param string $filename
* @param string $key key of the class it could be the full class name or only the namespace
*
* @throws Exception
*/
function s5cff67b7d578d__loadIfExists($filename, $key)
{
if (isset(s5cff67b7d578d__arrautoloadAbsolute[$key])) {
$fullFile = $filename; // its an absolute path
if (strpos($fullFile, '../') === 0) { // Or maybe, not, it's a remote-relative path.
$oldDir = getcwd(); // we copy the current url
chdir(__DIR__);
}
} else {
$fullFile = __DIR__.'/'.$filename; // its relative to this path
}
if ((@include $fullFile) === false) {
if (s5cff67b7d578d__debug) {
throw new Exception('AutoLoadOne Error: Loading file ['.__DIR__.'/'.$filename.'] for class ['.basename($filename).']');
} else {
throw new Exception('AutoLoadOne Error: No file found.');
}
} else {
if (isset($oldDir)) {
chdir($oldDir);
}
}
}
spl_autoload_register(function ($class_name) {
s5cff67b7d578d__auto($class_name);
});
// autorun
@include __DIR__.'../../../autoload.php';
@include __DIR__.'/vendor/autoload.php';