Commit
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,13 +158,17 @@ public static function autoload(\$class) | |
| $filesCode .= ' require '.$this->getPathCode($filesystem, $relVendorPath, $vendorPath, $functionFile).";\n"; | ||
| } | ||
|
|
||
| if (!$suffix) { | ||
| $suffix = md5(uniqid('', true)); | ||
| } | ||
|
|
||
| file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile); | ||
| file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile); | ||
| if ($includePathFile = $this->getIncludePathsFile($packageMap, $filesystem, $relVendorPath, $vendorPath, $vendorPathCode, $appBaseDirCode)) { | ||
| file_put_contents($targetDir.'/include_paths.php', $includePathFile); | ||
| } | ||
| file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix)); | ||
| file_put_contents($targetDir.'/autoload_real'.$suffix.'.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix)); | ||
| file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix)); | ||
| copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php'); | ||
| } | ||
|
|
||
|
|
@@ -313,7 +317,7 @@ protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix) | |
| // autoload.php generated by Composer | ||
| require_once $vendorPathToTargetDirCode . '/autoload_real$suffix.php'; | ||
| require_once $vendorPathToTargetDirCode . '/autoload_real.php'; | ||
| return ComposerAutoloaderInit$suffix::getLoader(); | ||
|
|
@@ -336,21 +340,29 @@ protected function getAutoloadRealFile($usePSR0, $useClassMap, $useIncludePath, | |
| $file = <<<HEADER | ||
| <?php | ||
| // autoload_real$suffix.php generated by Composer | ||
| require __DIR__ . '/ClassLoader.php'; | ||
| // autoload_real.php generated by Composer | ||
| class ComposerAutoloaderInit$suffix | ||
| { | ||
| private static \$loader; | ||
| public static function loadClassLoader(\$class) | ||
| { | ||
| if ('Composer\\Autoload\\ClassLoader' === \$class) { | ||
| require __DIR__ . '/ClassLoader.php'; | ||
| } | ||
| } | ||
| public static function getLoader() | ||
| { | ||
| if (null !== static::\$loader) { | ||
| return static::\$loader; | ||
| } | ||
| spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader')); | ||
| static::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader(); | ||
| spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader')); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
donquixote
Contributor
|
||
| \$vendorDir = $vendorPathCode; | ||
| \$baseDir = $appBaseDirCode; | ||
|
|
||
I am wondering, is this really necessary?
What about this.
It seems to me this would be more transparent and obvious.