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:
<?php
function netBazzlineComponentRequirementDevelopmentAutoloader($className)
{
$namespace = 'Net\\Bazzline\\Component\\Requirement\\';
$lengthOfNamespace = strlen($namespace);
$expectedNamespace = substr($className, 0, $lengthOfNamespace);
$isSupportedClassnameByNamespace = ($namespace == $expectedNamespace);
if ($isSupportedClassnameByNamespace) {
$classNameWithRemovedNamespace = str_replace($namespace, '', $className);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $classNameWithRemovedNamespace) . '.php';
$includePaths = array(
realpath(__DIR__ . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR
);
foreach ($includePaths as $includePath) {
$filePath = realpath($includePath . DIRECTORY_SEPARATOR . $fileName);
if (file_exists($filePath)) {
require $filePath;
break;
} else {
echo var_export(
array(
'classname' => $className,
'filename' => $fileName,
'filepath' => $filePath,
'includedPath' => $includePath
),
true
) . PHP_EOL;
}
}
} else {
return false;
}
}
spl_autoload_register('netBazzlineComponentRequirementDevelopmentAutoloader');