aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/composer/ClassLoader.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2021-02-04 21:01:25 +0100
committerMario Vavti <mario@mariovavti.com>2021-02-04 21:01:25 +0100
commita6162d3134cd7fcde4f45064b75f90008a7f8177 (patch)
tree7721c9cb8e5f23823bc0315429a7c638b65f5b4a /vendor/composer/ClassLoader.php
parent34b28cd8d36c7805e65c442ff1588ccf5165387a (diff)
downloadvolse-hubzilla-a6162d3134cd7fcde4f45064b75f90008a7f8177.tar.gz
volse-hubzilla-a6162d3134cd7fcde4f45064b75f90008a7f8177.tar.bz2
volse-hubzilla-a6162d3134cd7fcde4f45064b75f90008a7f8177.zip
downgrade phpseclib to version 2
Diffstat (limited to 'vendor/composer/ClassLoader.php')
-rw-r--r--vendor/composer/ClassLoader.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php
index 1a58957d2..4d989a212 100644
--- a/vendor/composer/ClassLoader.php
+++ b/vendor/composer/ClassLoader.php
@@ -42,6 +42,8 @@ namespace Composer\Autoload;
*/
class ClassLoader
{
+ private $vendorDir;
+
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
@@ -57,6 +59,13 @@ class ClassLoader
private $missingClasses = array();
private $apcuPrefix;
+ private static $registeredLoaders = array();
+
+ public function __construct($vendorDir = null)
+ {
+ $this->vendorDir = $vendorDir;
+ }
+
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
@@ -300,6 +309,15 @@ class ClassLoader
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
+
+ if (null === $this->vendorDir) {
+ //no-op
+ } elseif ($prepend) {
+ self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
+ } else {
+ unset(self::$registeredLoaders[$this->vendorDir]);
+ self::$registeredLoaders[$this->vendorDir] = $this;
+ }
}
/**
@@ -308,6 +326,10 @@ class ClassLoader
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
+
+ if (null !== $this->vendorDir) {
+ unset(self::$registeredLoaders[$this->vendorDir]);
+ }
}
/**
@@ -367,6 +389,16 @@ class ClassLoader
return $file;
}
+ /**
+ * Returns the currently registered loaders indexed by their corresponding vendor directories.
+ *
+ * @return self[]
+ */
+ public static function getRegisteredLoaders()
+ {
+ return self::$registeredLoaders;
+ }
+
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup