autoload_real_target_dir.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. // autoload_real.php @generated by Composer
  3. class ComposerAutoloaderInitTargetDir
  4. {
  5. private static $loader;
  6. public static function loadClassLoader($class)
  7. {
  8. if ('Composer\Autoload\ClassLoader' === $class) {
  9. require __DIR__ . '/ClassLoader.php';
  10. }
  11. }
  12. public static function getLoader()
  13. {
  14. if (null !== self::$loader) {
  15. return self::$loader;
  16. }
  17. spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader'), true, true);
  18. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  19. spl_autoload_unregister(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader'));
  20. if (PHP_VERSION_ID >= 50600) {
  21. require_once __DIR__ . '/autoload_static.php';
  22. \call_user_func(\Composer\Autoload\ComposerStaticInitTargetDir::getInitializer($loader));
  23. } else {
  24. $map = require __DIR__ . '/autoload_namespaces.php';
  25. foreach ($map as $namespace => $path) {
  26. $loader->set($namespace, $path);
  27. }
  28. $map = require __DIR__ . '/autoload_psr4.php';
  29. foreach ($map as $namespace => $path) {
  30. $loader->setPsr4($namespace, $path);
  31. }
  32. $classMap = require __DIR__ . '/autoload_classmap.php';
  33. if ($classMap) {
  34. $loader->addClassMap($classMap);
  35. }
  36. }
  37. spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'autoload'), true, true);
  38. $loader->register(true);
  39. if (PHP_VERSION_ID >= 50600) {
  40. $includeFiles = Composer\Autoload\ComposerStaticInitTargetDir::$files;
  41. } else {
  42. $includeFiles = require __DIR__ . '/autoload_files.php';
  43. }
  44. foreach ($includeFiles as $fileIdentifier => $file) {
  45. composerRequireTargetDir($fileIdentifier, $file);
  46. }
  47. return $loader;
  48. }
  49. public static function autoload($class)
  50. {
  51. $dir = dirname(dirname(__DIR__)) . '/';
  52. $prefixes = array('Main\\Foo', 'Main\\Bar');
  53. foreach ($prefixes as $prefix) {
  54. if (0 !== strpos($class, $prefix)) {
  55. continue;
  56. }
  57. $path = $dir . implode('/', array_slice(explode('\\', $class), 2)).'.php';
  58. if (!$path = stream_resolve_include_path($path)) {
  59. return false;
  60. }
  61. require $path;
  62. return true;
  63. }
  64. }
  65. }
  66. function composerRequireTargetDir($fileIdentifier, $file)
  67. {
  68. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  69. require $file;
  70. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  71. }
  72. }