- First commit of Negundo

This commit is contained in:
mcndave committed 2023-03-29 13:52:15 +00:00
commit 69ed176b1c
18 files changed
+846

No files matched your search

+32
View File
@@ -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;
}
});