[关闭]
@Chiang 2020-05-02T16:04:46.000000Z 字数 1968 阅读 484

autoload_real.php

Composer 2020-05


  • 感觉这里没啥好说的看代码就好了
  • $loader 定义静态常量(单例实例化赋值用)
  • loadClassLoader 引用当前核心类文件
  • getLoader 主体函数类似C语言中的main函数
  • composerRequire5620d294729feab5b1620b129a756f81 函数文件调用
  1. // autoload_real.php @generated by Composer
  2. class ComposerAutoloaderInit5620d294729feab5b1620b129a756f81
  3. {
  4. private static $loader;
  5. public static function loadClassLoader($class)
  6. {
  7. if ('Composer\Autoload\ClassLoader' === $class) {
  8. require __DIR__ . '/ClassLoader.php';
  9. }
  10. }
  11. public static function getLoader()
  12. {
  13. if (null !== self::$loader) {
  14. return self::$loader;
  15. }
  16. spl_autoload_register(array('ComposerAutoloaderInit5620d294729feab5b1620b129a756f81', 'loadClassLoader'), true, true);
  17. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  18. spl_autoload_unregister(array('ComposerAutoloaderInit5620d294729feab5b1620b129a756f81', 'loadClassLoader'));
  19. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  20. if ($useStaticLoader) {
  21. require_once __DIR__ . '/autoload_static.php';
  22. call_user_func(\Composer\Autoload\ComposerStaticInit5620d294729feab5b1620b129a756f81::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. $loader->register(true);
  38. if ($useStaticLoader) {
  39. $includeFiles = Composer\Autoload\ComposerStaticInit5620d294729feab5b1620b129a756f81::$files;
  40. } else {
  41. $includeFiles = require __DIR__ . '/autoload_files.php';
  42. }
  43. foreach ($includeFiles as $fileIdentifier => $file) {
  44. composerRequire5620d294729feab5b1620b129a756f81($fileIdentifier, $file);
  45. }
  46. return $loader;
  47. }
  48. }
  49. function composerRequire5620d294729feab5b1620b129a756f81($fileIdentifier, $file)
  50. {
  51. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  52. require $file;
  53. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  54. }
  55. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注