autoload_real_target_dir.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
  21. if ($useStaticLoader) {
  22. require_once __DIR__ . '/autoload_static.php';
  23. call_user_func(\Composer\Autoload\ComposerStaticInitTargetDir::getInitializer($loader));
  24. } else {
  25. $map = require __DIR__ . '/autoload_namespaces.php';
  26. foreach ($map as $namespace => $path) {
  27. $loader->set($namespace, $path);
  28. }
  29. $map = require __DIR__ . '/autoload_psr4.php';
  30. foreach ($map as $namespace => $path) {
  31. $loader->setPsr4($namespace, $path);
  32. }
  33. $classMap = require __DIR__ . '/autoload_classmap.php';
  34. if ($classMap) {
  35. $loader->addClassMap($classMap);
  36. }
  37. }
  38. spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'autoload'), true, true);
  39. $loader->register(true);
  40. if ($useStaticLoader) {
  41. $includeFiles = Composer\Autoload\ComposerStaticInitTargetDir::$files;
  42. } else {
  43. $includeFiles = require __DIR__ . '/autoload_files.php';
  44. }
  45. foreach ($includeFiles as $fileIdentifier => $file) {
  46. composerRequireTargetDir($fileIdentifier, $file);
  47. }
  48. return $loader;
  49. }
  50. public static function autoload($class)
  51. {
  52. $dir = dirname(dirname(__DIR__)) . '/';
  53. $prefixes = array('Main\\Foo', 'Main\\Bar');
  54. foreach ($prefixes as $prefix) {
  55. if (0 !== strpos($class, $prefix)) {
  56. continue;
  57. }
  58. $path = $dir . implode('/', array_slice(explode('\\', $class), 2)).'.php';
  59. if (!$path = stream_resolve_include_path($path)) {
  60. return false;
  61. }
  62. require $path;
  63. return true;
  64. }
  65. }
  66. }
  67. function composerRequireTargetDir($fileIdentifier, $file)
  68. {
  69. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  70. require $file;
  71. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  72. }
  73. }