autoload_real_include_path.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. // autoload_real.php @generated by Composer
  3. class ComposerAutoloaderInitIncludePath
  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. /**
  13. * @return \Composer\Autoload\ClassLoader
  14. */
  15. public static function getLoader()
  16. {
  17. if (null !== self::$loader) {
  18. return self::$loader;
  19. }
  20. require __DIR__ . '/platform_check.php';
  21. spl_autoload_register(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader'), true, true);
  22. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  23. spl_autoload_unregister(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader'));
  24. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  25. if ($useStaticLoader) {
  26. require __DIR__ . '/autoload_static.php';
  27. call_user_func(\Composer\Autoload\ComposerStaticInitIncludePath::getInitializer($loader));
  28. } else {
  29. $map = require __DIR__ . '/autoload_namespaces.php';
  30. foreach ($map as $namespace => $path) {
  31. $loader->set($namespace, $path);
  32. }
  33. $map = require __DIR__ . '/autoload_psr4.php';
  34. foreach ($map as $namespace => $path) {
  35. $loader->setPsr4($namespace, $path);
  36. }
  37. $classMap = require __DIR__ . '/autoload_classmap.php';
  38. if ($classMap) {
  39. $loader->addClassMap($classMap);
  40. }
  41. }
  42. $loader->setUseIncludePath(true);
  43. spl_autoload_register(array('ComposerAutoloaderInitIncludePath', 'autoload'), true, true);
  44. $loader->register(true);
  45. return $loader;
  46. }
  47. public static function autoload($class)
  48. {
  49. $dir = dirname(dirname(__DIR__)) . '/';
  50. $prefixes = array('Main\\Foo', 'Main\\Bar');
  51. foreach ($prefixes as $prefix) {
  52. if (0 !== strpos($class, $prefix)) {
  53. continue;
  54. }
  55. $path = $dir . implode('/', array_slice(explode('\\', $class), 2)).'.php';
  56. if (!$path = stream_resolve_include_path($path)) {
  57. return false;
  58. }
  59. require $path;
  60. return true;
  61. }
  62. }
  63. }