- First commit of Negundo
This commit is contained in:
commit
69ed176b1c
18 files changed
+846
No files matched your search
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* An example of a project-specific implementation.
|
||||
*
|
||||
* After registering this autoload function with SPL, the following line
|
||||
* would cause the function to attempt to load the \Foo\Bar\Baz\Qux class
|
||||
* from /path/to/project/src/Baz/Qux.php:
|
||||
*
|
||||
* new \Foo\Bar\Baz\Qux;
|
||||
*
|
||||
* @param string $class The fully-qualified class name.
|
||||
* @return void
|
||||
* @link https://www.php-fig.org/psr/psr-4/examples/
|
||||
*/
|
||||
spl_autoload_register(function ($class) {
|
||||
$prefix = 'Negundo\\';
|
||||
|
||||
$base_dir = __DIR__ . '/src/';
|
||||
|
||||
$len = strlen($prefix);
|
||||
|
||||
if (strncmp($prefix, $class, $len) !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$file = $base_dir . str_replace('\\', '/', substr($class, $len)) . '.php';
|
||||
|
||||
if ( file_exists($file) ) {
|
||||
require $file;
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user