2023-03-29 13:52:15 +00:00
|
|
|
<?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) {
|
2023-03-30 18:15:31 +00:00
|
|
|
$prefix = 'Negundo\\Client\\';
|
2023-03-29 13:52:15 +00:00
|
|
|
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
});
|