autoload_real_include_path.php 2.4 KB

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