diff options
author | zotlabs <mike@macgirvin.com> | 2018-01-13 15:55:04 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-01-13 15:55:04 -0800 |
commit | 75285fd452147aba7d2edf938d63c158384095b5 (patch) | |
tree | f3222b200936a1c5a907f6e987bb45d26e9ecc95 /vendor/composer/ClassLoader.php | |
parent | eb3e43feec4e2de439de5398fcf498c0de5afbd4 (diff) | |
parent | ce10a44e722c9bbaceff64273641c3e08c6ad7a5 (diff) | |
download | volse-hubzilla-75285fd452147aba7d2edf938d63c158384095b5.tar.gz volse-hubzilla-75285fd452147aba7d2edf938d63c158384095b5.tar.bz2 volse-hubzilla-75285fd452147aba7d2edf938d63c158384095b5.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
Diffstat (limited to 'vendor/composer/ClassLoader.php')
-rw-r--r-- | vendor/composer/ClassLoader.php | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 2c72175e7..c6f6d2322 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -43,7 +43,8 @@ namespace Composer\Autoload; class ClassLoader { // PSR-4 - private $prefixLengthsPsr4 = array(); + private $firstCharsPsr4 = array(); + private $prefixLengthsPsr4 = array(); // For BC with legacy static maps private $prefixDirsPsr4 = array(); private $fallbackDirsPsr4 = array(); @@ -170,11 +171,10 @@ class ClassLoader } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { + if ('\\' !== substr($prefix, -1)) { throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->firstCharsPsr4[$prefix[0]] = true; $this->prefixDirsPsr4[$prefix] = (array) $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. @@ -221,11 +221,10 @@ class ClassLoader if (!$prefix) { $this->fallbackDirsPsr4 = (array) $paths; } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { + if ('\\' !== substr($prefix, -1)) { throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->firstCharsPsr4[$prefix[0]] = true; $this->prefixDirsPsr4[$prefix] = (array) $paths; } } @@ -373,15 +372,15 @@ class ClassLoader $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { + if (isset($this->firstCharsPsr4[$first]) || isset($this->prefixLengthsPsr4[$first])) { $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); $search = $subPath.'\\'; if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { - $length = $this->prefixLengthsPsr4[$first][$search]; - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + if (file_exists($file = $dir . $pathEnd)) { return $file; } } |