@@ -24,327 +24,327 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class InstalledVersions |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @var mixed[]|null |
|
| 29 | - * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null |
|
| 30 | - */ |
|
| 31 | - private static $installed; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @var bool|null |
|
| 35 | - */ |
|
| 36 | - private static $canGetVendors; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * @var array[] |
|
| 40 | - * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 41 | - */ |
|
| 42 | - private static $installedByVendor = array(); |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Returns a list of all package names which are present, either by being installed, replaced or provided |
|
| 46 | - * |
|
| 47 | - * @return string[] |
|
| 48 | - * @psalm-return list<string> |
|
| 49 | - */ |
|
| 50 | - public static function getInstalledPackages() |
|
| 51 | - { |
|
| 52 | - $packages = array(); |
|
| 53 | - foreach (self::getInstalled() as $installed) { |
|
| 54 | - $packages[] = array_keys($installed['versions']); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - if (1 === \count($packages)) { |
|
| 58 | - return $packages[0]; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * Returns a list of all package names with a specific type e.g. 'library' |
|
| 66 | - * |
|
| 67 | - * @param string $type |
|
| 68 | - * @return string[] |
|
| 69 | - * @psalm-return list<string> |
|
| 70 | - */ |
|
| 71 | - public static function getInstalledPackagesByType($type) |
|
| 72 | - { |
|
| 73 | - $packagesByType = array(); |
|
| 74 | - |
|
| 75 | - foreach (self::getInstalled() as $installed) { |
|
| 76 | - foreach ($installed['versions'] as $name => $package) { |
|
| 77 | - if (isset($package['type']) && $package['type'] === $type) { |
|
| 78 | - $packagesByType[] = $name; |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - return $packagesByType; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * Checks whether the given package is installed |
|
| 88 | - * |
|
| 89 | - * This also returns true if the package name is provided or replaced by another package |
|
| 90 | - * |
|
| 91 | - * @param string $packageName |
|
| 92 | - * @param bool $includeDevRequirements |
|
| 93 | - * @return bool |
|
| 94 | - */ |
|
| 95 | - public static function isInstalled($packageName, $includeDevRequirements = true) |
|
| 96 | - { |
|
| 97 | - foreach (self::getInstalled() as $installed) { |
|
| 98 | - if (isset($installed['versions'][$packageName])) { |
|
| 99 | - return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - return false; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Checks whether the given package satisfies a version constraint |
|
| 108 | - * |
|
| 109 | - * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: |
|
| 110 | - * |
|
| 111 | - * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') |
|
| 112 | - * |
|
| 113 | - * @param VersionParser $parser Install composer/semver to have access to this class and functionality |
|
| 114 | - * @param string $packageName |
|
| 115 | - * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package |
|
| 116 | - * @return bool |
|
| 117 | - */ |
|
| 118 | - public static function satisfies(VersionParser $parser, $packageName, $constraint) |
|
| 119 | - { |
|
| 120 | - $constraint = $parser->parseConstraints($constraint); |
|
| 121 | - $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); |
|
| 122 | - |
|
| 123 | - return $provided->matches($constraint); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Returns a version constraint representing all the range(s) which are installed for a given package |
|
| 128 | - * |
|
| 129 | - * It is easier to use this via isInstalled() with the $constraint argument if you need to check |
|
| 130 | - * whether a given version of a package is installed, and not just whether it exists |
|
| 131 | - * |
|
| 132 | - * @param string $packageName |
|
| 133 | - * @return string Version constraint usable with composer/semver |
|
| 134 | - */ |
|
| 135 | - public static function getVersionRanges($packageName) |
|
| 136 | - { |
|
| 137 | - foreach (self::getInstalled() as $installed) { |
|
| 138 | - if (!isset($installed['versions'][$packageName])) { |
|
| 139 | - continue; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - $ranges = array(); |
|
| 143 | - if (isset($installed['versions'][$packageName]['pretty_version'])) { |
|
| 144 | - $ranges[] = $installed['versions'][$packageName]['pretty_version']; |
|
| 145 | - } |
|
| 146 | - if (array_key_exists('aliases', $installed['versions'][$packageName])) { |
|
| 147 | - $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); |
|
| 148 | - } |
|
| 149 | - if (array_key_exists('replaced', $installed['versions'][$packageName])) { |
|
| 150 | - $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); |
|
| 151 | - } |
|
| 152 | - if (array_key_exists('provided', $installed['versions'][$packageName])) { |
|
| 153 | - $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - return implode(' || ', $ranges); |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * @param string $packageName |
|
| 164 | - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
|
| 165 | - */ |
|
| 166 | - public static function getVersion($packageName) |
|
| 167 | - { |
|
| 168 | - foreach (self::getInstalled() as $installed) { |
|
| 169 | - if (!isset($installed['versions'][$packageName])) { |
|
| 170 | - continue; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - if (!isset($installed['versions'][$packageName]['version'])) { |
|
| 174 | - return null; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - return $installed['versions'][$packageName]['version']; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * @param string $packageName |
|
| 185 | - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
|
| 186 | - */ |
|
| 187 | - public static function getPrettyVersion($packageName) |
|
| 188 | - { |
|
| 189 | - foreach (self::getInstalled() as $installed) { |
|
| 190 | - if (!isset($installed['versions'][$packageName])) { |
|
| 191 | - continue; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - if (!isset($installed['versions'][$packageName]['pretty_version'])) { |
|
| 195 | - return null; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - return $installed['versions'][$packageName]['pretty_version']; |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * @param string $packageName |
|
| 206 | - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference |
|
| 207 | - */ |
|
| 208 | - public static function getReference($packageName) |
|
| 209 | - { |
|
| 210 | - foreach (self::getInstalled() as $installed) { |
|
| 211 | - if (!isset($installed['versions'][$packageName])) { |
|
| 212 | - continue; |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - if (!isset($installed['versions'][$packageName]['reference'])) { |
|
| 216 | - return null; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - return $installed['versions'][$packageName]['reference']; |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - /** |
|
| 226 | - * @param string $packageName |
|
| 227 | - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. |
|
| 228 | - */ |
|
| 229 | - public static function getInstallPath($packageName) |
|
| 230 | - { |
|
| 231 | - foreach (self::getInstalled() as $installed) { |
|
| 232 | - if (!isset($installed['versions'][$packageName])) { |
|
| 233 | - continue; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * @return array |
|
| 244 | - * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} |
|
| 245 | - */ |
|
| 246 | - public static function getRootPackage() |
|
| 247 | - { |
|
| 248 | - $installed = self::getInstalled(); |
|
| 249 | - |
|
| 250 | - return $installed[0]['root']; |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - /** |
|
| 254 | - * Returns the raw installed.php data for custom implementations |
|
| 255 | - * |
|
| 256 | - * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. |
|
| 257 | - * @return array[] |
|
| 258 | - * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} |
|
| 259 | - */ |
|
| 260 | - public static function getRawData() |
|
| 261 | - { |
|
| 262 | - @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); |
|
| 263 | - |
|
| 264 | - if (null === self::$installed) { |
|
| 265 | - // only require the installed.php file if this file is loaded from its dumped location, |
|
| 266 | - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
|
| 267 | - if (substr(__DIR__, -8, 1) !== 'C') { |
|
| 268 | - self::$installed = include __DIR__ . '/installed.php'; |
|
| 269 | - } else { |
|
| 270 | - self::$installed = array(); |
|
| 271 | - } |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - return self::$installed; |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * Returns the raw data of all installed.php which are currently loaded for custom implementations |
|
| 279 | - * |
|
| 280 | - * @return array[] |
|
| 281 | - * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 282 | - */ |
|
| 283 | - public static function getAllRawData() |
|
| 284 | - { |
|
| 285 | - return self::getInstalled(); |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - /** |
|
| 289 | - * Lets you reload the static array from another file |
|
| 290 | - * |
|
| 291 | - * This is only useful for complex integrations in which a project needs to use |
|
| 292 | - * this class but then also needs to execute another project's autoloader in process, |
|
| 293 | - * and wants to ensure both projects have access to their version of installed.php. |
|
| 294 | - * |
|
| 295 | - * A typical case would be PHPUnit, where it would need to make sure it reads all |
|
| 296 | - * the data it needs from this class, then call reload() with |
|
| 297 | - * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure |
|
| 298 | - * the project in which it runs can then also use this class safely, without |
|
| 299 | - * interference between PHPUnit's dependencies and the project's dependencies. |
|
| 300 | - * |
|
| 301 | - * @param array[] $data A vendor/composer/installed.php data set |
|
| 302 | - * @return void |
|
| 303 | - * |
|
| 304 | - * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data |
|
| 305 | - */ |
|
| 306 | - public static function reload($data) |
|
| 307 | - { |
|
| 308 | - self::$installed = $data; |
|
| 309 | - self::$installedByVendor = array(); |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * @return array[] |
|
| 314 | - * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 315 | - */ |
|
| 316 | - private static function getInstalled() |
|
| 317 | - { |
|
| 318 | - if (null === self::$canGetVendors) { |
|
| 319 | - self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - $installed = array(); |
|
| 323 | - |
|
| 324 | - if (self::$canGetVendors) { |
|
| 325 | - foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { |
|
| 326 | - if (isset(self::$installedByVendor[$vendorDir])) { |
|
| 327 | - $installed[] = self::$installedByVendor[$vendorDir]; |
|
| 328 | - } elseif (is_file($vendorDir.'/composer/installed.php')) { |
|
| 329 | - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; |
|
| 330 | - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
| 331 | - self::$installed = $installed[count($installed) - 1]; |
|
| 332 | - } |
|
| 333 | - } |
|
| 334 | - } |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - if (null === self::$installed) { |
|
| 338 | - // only require the installed.php file if this file is loaded from its dumped location, |
|
| 339 | - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
|
| 340 | - if (substr(__DIR__, -8, 1) !== 'C') { |
|
| 341 | - self::$installed = require __DIR__ . '/installed.php'; |
|
| 342 | - } else { |
|
| 343 | - self::$installed = array(); |
|
| 344 | - } |
|
| 345 | - } |
|
| 346 | - $installed[] = self::$installed; |
|
| 347 | - |
|
| 348 | - return $installed; |
|
| 349 | - } |
|
| 27 | + /** |
|
| 28 | + * @var mixed[]|null |
|
| 29 | + * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null |
|
| 30 | + */ |
|
| 31 | + private static $installed; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @var bool|null |
|
| 35 | + */ |
|
| 36 | + private static $canGetVendors; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @var array[] |
|
| 40 | + * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 41 | + */ |
|
| 42 | + private static $installedByVendor = array(); |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Returns a list of all package names which are present, either by being installed, replaced or provided |
|
| 46 | + * |
|
| 47 | + * @return string[] |
|
| 48 | + * @psalm-return list<string> |
|
| 49 | + */ |
|
| 50 | + public static function getInstalledPackages() |
|
| 51 | + { |
|
| 52 | + $packages = array(); |
|
| 53 | + foreach (self::getInstalled() as $installed) { |
|
| 54 | + $packages[] = array_keys($installed['versions']); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + if (1 === \count($packages)) { |
|
| 58 | + return $packages[0]; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * Returns a list of all package names with a specific type e.g. 'library' |
|
| 66 | + * |
|
| 67 | + * @param string $type |
|
| 68 | + * @return string[] |
|
| 69 | + * @psalm-return list<string> |
|
| 70 | + */ |
|
| 71 | + public static function getInstalledPackagesByType($type) |
|
| 72 | + { |
|
| 73 | + $packagesByType = array(); |
|
| 74 | + |
|
| 75 | + foreach (self::getInstalled() as $installed) { |
|
| 76 | + foreach ($installed['versions'] as $name => $package) { |
|
| 77 | + if (isset($package['type']) && $package['type'] === $type) { |
|
| 78 | + $packagesByType[] = $name; |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + return $packagesByType; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * Checks whether the given package is installed |
|
| 88 | + * |
|
| 89 | + * This also returns true if the package name is provided or replaced by another package |
|
| 90 | + * |
|
| 91 | + * @param string $packageName |
|
| 92 | + * @param bool $includeDevRequirements |
|
| 93 | + * @return bool |
|
| 94 | + */ |
|
| 95 | + public static function isInstalled($packageName, $includeDevRequirements = true) |
|
| 96 | + { |
|
| 97 | + foreach (self::getInstalled() as $installed) { |
|
| 98 | + if (isset($installed['versions'][$packageName])) { |
|
| 99 | + return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + return false; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Checks whether the given package satisfies a version constraint |
|
| 108 | + * |
|
| 109 | + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: |
|
| 110 | + * |
|
| 111 | + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') |
|
| 112 | + * |
|
| 113 | + * @param VersionParser $parser Install composer/semver to have access to this class and functionality |
|
| 114 | + * @param string $packageName |
|
| 115 | + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package |
|
| 116 | + * @return bool |
|
| 117 | + */ |
|
| 118 | + public static function satisfies(VersionParser $parser, $packageName, $constraint) |
|
| 119 | + { |
|
| 120 | + $constraint = $parser->parseConstraints($constraint); |
|
| 121 | + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); |
|
| 122 | + |
|
| 123 | + return $provided->matches($constraint); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Returns a version constraint representing all the range(s) which are installed for a given package |
|
| 128 | + * |
|
| 129 | + * It is easier to use this via isInstalled() with the $constraint argument if you need to check |
|
| 130 | + * whether a given version of a package is installed, and not just whether it exists |
|
| 131 | + * |
|
| 132 | + * @param string $packageName |
|
| 133 | + * @return string Version constraint usable with composer/semver |
|
| 134 | + */ |
|
| 135 | + public static function getVersionRanges($packageName) |
|
| 136 | + { |
|
| 137 | + foreach (self::getInstalled() as $installed) { |
|
| 138 | + if (!isset($installed['versions'][$packageName])) { |
|
| 139 | + continue; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + $ranges = array(); |
|
| 143 | + if (isset($installed['versions'][$packageName]['pretty_version'])) { |
|
| 144 | + $ranges[] = $installed['versions'][$packageName]['pretty_version']; |
|
| 145 | + } |
|
| 146 | + if (array_key_exists('aliases', $installed['versions'][$packageName])) { |
|
| 147 | + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); |
|
| 148 | + } |
|
| 149 | + if (array_key_exists('replaced', $installed['versions'][$packageName])) { |
|
| 150 | + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); |
|
| 151 | + } |
|
| 152 | + if (array_key_exists('provided', $installed['versions'][$packageName])) { |
|
| 153 | + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + return implode(' || ', $ranges); |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * @param string $packageName |
|
| 164 | + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
|
| 165 | + */ |
|
| 166 | + public static function getVersion($packageName) |
|
| 167 | + { |
|
| 168 | + foreach (self::getInstalled() as $installed) { |
|
| 169 | + if (!isset($installed['versions'][$packageName])) { |
|
| 170 | + continue; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + if (!isset($installed['versions'][$packageName]['version'])) { |
|
| 174 | + return null; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + return $installed['versions'][$packageName]['version']; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * @param string $packageName |
|
| 185 | + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
|
| 186 | + */ |
|
| 187 | + public static function getPrettyVersion($packageName) |
|
| 188 | + { |
|
| 189 | + foreach (self::getInstalled() as $installed) { |
|
| 190 | + if (!isset($installed['versions'][$packageName])) { |
|
| 191 | + continue; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + if (!isset($installed['versions'][$packageName]['pretty_version'])) { |
|
| 195 | + return null; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + return $installed['versions'][$packageName]['pretty_version']; |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * @param string $packageName |
|
| 206 | + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference |
|
| 207 | + */ |
|
| 208 | + public static function getReference($packageName) |
|
| 209 | + { |
|
| 210 | + foreach (self::getInstalled() as $installed) { |
|
| 211 | + if (!isset($installed['versions'][$packageName])) { |
|
| 212 | + continue; |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + if (!isset($installed['versions'][$packageName]['reference'])) { |
|
| 216 | + return null; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + return $installed['versions'][$packageName]['reference']; |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + /** |
|
| 226 | + * @param string $packageName |
|
| 227 | + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. |
|
| 228 | + */ |
|
| 229 | + public static function getInstallPath($packageName) |
|
| 230 | + { |
|
| 231 | + foreach (self::getInstalled() as $installed) { |
|
| 232 | + if (!isset($installed['versions'][$packageName])) { |
|
| 233 | + continue; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * @return array |
|
| 244 | + * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} |
|
| 245 | + */ |
|
| 246 | + public static function getRootPackage() |
|
| 247 | + { |
|
| 248 | + $installed = self::getInstalled(); |
|
| 249 | + |
|
| 250 | + return $installed[0]['root']; |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * Returns the raw installed.php data for custom implementations |
|
| 255 | + * |
|
| 256 | + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. |
|
| 257 | + * @return array[] |
|
| 258 | + * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} |
|
| 259 | + */ |
|
| 260 | + public static function getRawData() |
|
| 261 | + { |
|
| 262 | + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); |
|
| 263 | + |
|
| 264 | + if (null === self::$installed) { |
|
| 265 | + // only require the installed.php file if this file is loaded from its dumped location, |
|
| 266 | + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
|
| 267 | + if (substr(__DIR__, -8, 1) !== 'C') { |
|
| 268 | + self::$installed = include __DIR__ . '/installed.php'; |
|
| 269 | + } else { |
|
| 270 | + self::$installed = array(); |
|
| 271 | + } |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + return self::$installed; |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * Returns the raw data of all installed.php which are currently loaded for custom implementations |
|
| 279 | + * |
|
| 280 | + * @return array[] |
|
| 281 | + * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 282 | + */ |
|
| 283 | + public static function getAllRawData() |
|
| 284 | + { |
|
| 285 | + return self::getInstalled(); |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + /** |
|
| 289 | + * Lets you reload the static array from another file |
|
| 290 | + * |
|
| 291 | + * This is only useful for complex integrations in which a project needs to use |
|
| 292 | + * this class but then also needs to execute another project's autoloader in process, |
|
| 293 | + * and wants to ensure both projects have access to their version of installed.php. |
|
| 294 | + * |
|
| 295 | + * A typical case would be PHPUnit, where it would need to make sure it reads all |
|
| 296 | + * the data it needs from this class, then call reload() with |
|
| 297 | + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure |
|
| 298 | + * the project in which it runs can then also use this class safely, without |
|
| 299 | + * interference between PHPUnit's dependencies and the project's dependencies. |
|
| 300 | + * |
|
| 301 | + * @param array[] $data A vendor/composer/installed.php data set |
|
| 302 | + * @return void |
|
| 303 | + * |
|
| 304 | + * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data |
|
| 305 | + */ |
|
| 306 | + public static function reload($data) |
|
| 307 | + { |
|
| 308 | + self::$installed = $data; |
|
| 309 | + self::$installedByVendor = array(); |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * @return array[] |
|
| 314 | + * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
|
| 315 | + */ |
|
| 316 | + private static function getInstalled() |
|
| 317 | + { |
|
| 318 | + if (null === self::$canGetVendors) { |
|
| 319 | + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + $installed = array(); |
|
| 323 | + |
|
| 324 | + if (self::$canGetVendors) { |
|
| 325 | + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { |
|
| 326 | + if (isset(self::$installedByVendor[$vendorDir])) { |
|
| 327 | + $installed[] = self::$installedByVendor[$vendorDir]; |
|
| 328 | + } elseif (is_file($vendorDir.'/composer/installed.php')) { |
|
| 329 | + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; |
|
| 330 | + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
| 331 | + self::$installed = $installed[count($installed) - 1]; |
|
| 332 | + } |
|
| 333 | + } |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + if (null === self::$installed) { |
|
| 338 | + // only require the installed.php file if this file is loaded from its dumped location, |
|
| 339 | + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
|
| 340 | + if (substr(__DIR__, -8, 1) !== 'C') { |
|
| 341 | + self::$installed = require __DIR__ . '/installed.php'; |
|
| 342 | + } else { |
|
| 343 | + self::$installed = array(); |
|
| 344 | + } |
|
| 345 | + } |
|
| 346 | + $installed[] = self::$installed; |
|
| 347 | + |
|
| 348 | + return $installed; |
|
| 349 | + } |
|
| 350 | 350 | } |
@@ -47,8 +47,7 @@ discard block |
||
| 47 | 47 | * @return string[] |
| 48 | 48 | * @psalm-return list<string> |
| 49 | 49 | */ |
| 50 | - public static function getInstalledPackages() |
|
| 51 | - { |
|
| 50 | + public static function getInstalledPackages() { |
|
| 52 | 51 | $packages = array(); |
| 53 | 52 | foreach (self::getInstalled() as $installed) { |
| 54 | 53 | $packages[] = array_keys($installed['versions']); |
@@ -68,8 +67,7 @@ discard block |
||
| 68 | 67 | * @return string[] |
| 69 | 68 | * @psalm-return list<string> |
| 70 | 69 | */ |
| 71 | - public static function getInstalledPackagesByType($type) |
|
| 72 | - { |
|
| 70 | + public static function getInstalledPackagesByType($type) { |
|
| 73 | 71 | $packagesByType = array(); |
| 74 | 72 | |
| 75 | 73 | foreach (self::getInstalled() as $installed) { |
@@ -92,8 +90,7 @@ discard block |
||
| 92 | 90 | * @param bool $includeDevRequirements |
| 93 | 91 | * @return bool |
| 94 | 92 | */ |
| 95 | - public static function isInstalled($packageName, $includeDevRequirements = true) |
|
| 96 | - { |
|
| 93 | + public static function isInstalled($packageName, $includeDevRequirements = true) { |
|
| 97 | 94 | foreach (self::getInstalled() as $installed) { |
| 98 | 95 | if (isset($installed['versions'][$packageName])) { |
| 99 | 96 | return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); |
@@ -115,8 +112,7 @@ discard block |
||
| 115 | 112 | * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package |
| 116 | 113 | * @return bool |
| 117 | 114 | */ |
| 118 | - public static function satisfies(VersionParser $parser, $packageName, $constraint) |
|
| 119 | - { |
|
| 115 | + public static function satisfies(VersionParser $parser, $packageName, $constraint) { |
|
| 120 | 116 | $constraint = $parser->parseConstraints($constraint); |
| 121 | 117 | $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); |
| 122 | 118 | |
@@ -132,8 +128,7 @@ discard block |
||
| 132 | 128 | * @param string $packageName |
| 133 | 129 | * @return string Version constraint usable with composer/semver |
| 134 | 130 | */ |
| 135 | - public static function getVersionRanges($packageName) |
|
| 136 | - { |
|
| 131 | + public static function getVersionRanges($packageName) { |
|
| 137 | 132 | foreach (self::getInstalled() as $installed) { |
| 138 | 133 | if (!isset($installed['versions'][$packageName])) { |
| 139 | 134 | continue; |
@@ -163,8 +158,7 @@ discard block |
||
| 163 | 158 | * @param string $packageName |
| 164 | 159 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
| 165 | 160 | */ |
| 166 | - public static function getVersion($packageName) |
|
| 167 | - { |
|
| 161 | + public static function getVersion($packageName) { |
|
| 168 | 162 | foreach (self::getInstalled() as $installed) { |
| 169 | 163 | if (!isset($installed['versions'][$packageName])) { |
| 170 | 164 | continue; |
@@ -184,8 +178,7 @@ discard block |
||
| 184 | 178 | * @param string $packageName |
| 185 | 179 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present |
| 186 | 180 | */ |
| 187 | - public static function getPrettyVersion($packageName) |
|
| 188 | - { |
|
| 181 | + public static function getPrettyVersion($packageName) { |
|
| 189 | 182 | foreach (self::getInstalled() as $installed) { |
| 190 | 183 | if (!isset($installed['versions'][$packageName])) { |
| 191 | 184 | continue; |
@@ -205,8 +198,7 @@ discard block |
||
| 205 | 198 | * @param string $packageName |
| 206 | 199 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference |
| 207 | 200 | */ |
| 208 | - public static function getReference($packageName) |
|
| 209 | - { |
|
| 201 | + public static function getReference($packageName) { |
|
| 210 | 202 | foreach (self::getInstalled() as $installed) { |
| 211 | 203 | if (!isset($installed['versions'][$packageName])) { |
| 212 | 204 | continue; |
@@ -226,8 +218,7 @@ discard block |
||
| 226 | 218 | * @param string $packageName |
| 227 | 219 | * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. |
| 228 | 220 | */ |
| 229 | - public static function getInstallPath($packageName) |
|
| 230 | - { |
|
| 221 | + public static function getInstallPath($packageName) { |
|
| 231 | 222 | foreach (self::getInstalled() as $installed) { |
| 232 | 223 | if (!isset($installed['versions'][$packageName])) { |
| 233 | 224 | continue; |
@@ -243,8 +234,7 @@ discard block |
||
| 243 | 234 | * @return array |
| 244 | 235 | * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} |
| 245 | 236 | */ |
| 246 | - public static function getRootPackage() |
|
| 247 | - { |
|
| 237 | + public static function getRootPackage() { |
|
| 248 | 238 | $installed = self::getInstalled(); |
| 249 | 239 | |
| 250 | 240 | return $installed[0]['root']; |
@@ -257,8 +247,7 @@ discard block |
||
| 257 | 247 | * @return array[] |
| 258 | 248 | * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} |
| 259 | 249 | */ |
| 260 | - public static function getRawData() |
|
| 261 | - { |
|
| 250 | + public static function getRawData() { |
|
| 262 | 251 | @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); |
| 263 | 252 | |
| 264 | 253 | if (null === self::$installed) { |
@@ -266,7 +255,8 @@ discard block |
||
| 266 | 255 | // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
| 267 | 256 | if (substr(__DIR__, -8, 1) !== 'C') { |
| 268 | 257 | self::$installed = include __DIR__ . '/installed.php'; |
| 269 | - } else { |
|
| 258 | + } |
|
| 259 | + else { |
|
| 270 | 260 | self::$installed = array(); |
| 271 | 261 | } |
| 272 | 262 | } |
@@ -280,8 +270,7 @@ discard block |
||
| 280 | 270 | * @return array[] |
| 281 | 271 | * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
| 282 | 272 | */ |
| 283 | - public static function getAllRawData() |
|
| 284 | - { |
|
| 273 | + public static function getAllRawData() { |
|
| 285 | 274 | return self::getInstalled(); |
| 286 | 275 | } |
| 287 | 276 | |
@@ -303,8 +292,7 @@ discard block |
||
| 303 | 292 | * |
| 304 | 293 | * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data |
| 305 | 294 | */ |
| 306 | - public static function reload($data) |
|
| 307 | - { |
|
| 295 | + public static function reload($data) { |
|
| 308 | 296 | self::$installed = $data; |
| 309 | 297 | self::$installedByVendor = array(); |
| 310 | 298 | } |
@@ -313,8 +301,7 @@ discard block |
||
| 313 | 301 | * @return array[] |
| 314 | 302 | * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> |
| 315 | 303 | */ |
| 316 | - private static function getInstalled() |
|
| 317 | - { |
|
| 304 | + private static function getInstalled() { |
|
| 318 | 305 | if (null === self::$canGetVendors) { |
| 319 | 306 | self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); |
| 320 | 307 | } |
@@ -325,7 +312,8 @@ discard block |
||
| 325 | 312 | foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { |
| 326 | 313 | if (isset(self::$installedByVendor[$vendorDir])) { |
| 327 | 314 | $installed[] = self::$installedByVendor[$vendorDir]; |
| 328 | - } elseif (is_file($vendorDir.'/composer/installed.php')) { |
|
| 315 | + } |
|
| 316 | + elseif (is_file($vendorDir.'/composer/installed.php')) { |
|
| 329 | 317 | $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; |
| 330 | 318 | if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
| 331 | 319 | self::$installed = $installed[count($installed) - 1]; |
@@ -339,7 +327,8 @@ discard block |
||
| 339 | 327 | // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
| 340 | 328 | if (substr(__DIR__, -8, 1) !== 'C') { |
| 341 | 329 | self::$installed = require __DIR__ . '/installed.php'; |
| 342 | - } else { |
|
| 330 | + } |
|
| 331 | + else { |
|
| 343 | 332 | self::$installed = array(); |
| 344 | 333 | } |
| 345 | 334 | } |
@@ -161,8 +161,7 @@ |
||
| 161 | 161 | 'WBXMLException' => __DIR__ . '/../..' . '/lib/exceptions/wbxmlexception.php', |
| 162 | 162 | ); |
| 163 | 163 | |
| 164 | - public static function getInitializer(ClassLoader $loader) |
|
| 165 | - { |
|
| 164 | + public static function getInitializer(ClassLoader $loader) { |
|
| 166 | 165 | return \Closure::bind(function () use ($loader) { |
| 167 | 166 | $loader->classMap = ComposerStaticInit153a56a781a72686b71399955d98204f::$classMap; |
| 168 | 167 | |
@@ -6,167 +6,167 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ComposerStaticInit153a56a781a72686b71399955d98204f |
| 8 | 8 | { |
| 9 | - public static $files = array ( |
|
| 10 | - '158e247719544c05f5e89c414f630c24' => __DIR__ . '/../..' . '/version.php', |
|
| 11 | - 'f2969980cdf0dddd210ef5448430b9c0' => __DIR__ . '/../..' . '/lib/core/gsyncdefs.php', |
|
| 12 | - 'd2a63a53b4a43a2bd71de0cec5c1abfb' => __DIR__ . '/../..' . '/lib/utils/compat.php', |
|
| 13 | - ); |
|
| 9 | + public static $files = array ( |
|
| 10 | + '158e247719544c05f5e89c414f630c24' => __DIR__ . '/../..' . '/version.php', |
|
| 11 | + 'f2969980cdf0dddd210ef5448430b9c0' => __DIR__ . '/../..' . '/lib/core/gsyncdefs.php', |
|
| 12 | + 'd2a63a53b4a43a2bd71de0cec5c1abfb' => __DIR__ . '/../..' . '/lib/utils/compat.php', |
|
| 13 | + ); |
|
| 14 | 14 | |
| 15 | - public static $classMap = array ( |
|
| 16 | - 'ASDevice' => __DIR__ . '/../..' . '/lib/core/asdevice.php', |
|
| 17 | - 'AuthenticationRequiredException' => __DIR__ . '/../..' . '/lib/exceptions/authenticationrequiredexception.php', |
|
| 18 | - 'BaseException' => '/usr/share/php-mapi/class.baseexception.php', |
|
| 19 | - 'BaseRecurrence' => '/usr/share/php-mapi/class.baserecurrence.php', |
|
| 20 | - 'BodyPartPreference' => __DIR__ . '/../..' . '/lib/core/bodypartpreference.php', |
|
| 21 | - 'BodyPreference' => __DIR__ . '/../..' . '/lib/core/bodypreference.php', |
|
| 22 | - 'ChangesMemoryWrapper' => __DIR__ . '/../..' . '/lib/core/changesmemorywrapper.php', |
|
| 23 | - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
|
| 24 | - 'ConnectionTracking' => __DIR__ . '/../..' . '/lib/core/connectiontracking.php', |
|
| 25 | - 'ContentParameters' => __DIR__ . '/../..' . '/lib/core/contentparameters.php', |
|
| 26 | - 'DeviceManager' => __DIR__ . '/../..' . '/lib/core/devicemanager.php', |
|
| 27 | - 'ExportChangesICS' => __DIR__ . '/../..' . '/lib/grommunio/exporter.php', |
|
| 28 | - 'FatalException' => __DIR__ . '/../..' . '/lib/exceptions/fatalexception.php', |
|
| 29 | - 'FatalMisconfigurationException' => __DIR__ . '/../..' . '/lib/exceptions/fatalmisconfigurationexception.php', |
|
| 30 | - 'FatalNotImplementedException' => __DIR__ . '/../..' . '/lib/exceptions/fatalnotimplementedexception.php', |
|
| 31 | - 'FileLog' => __DIR__ . '/../..' . '/lib/log/filelog.php', |
|
| 32 | - 'Find' => __DIR__ . '/../..' . '/lib/request/find.php', |
|
| 33 | - 'FolderChange' => __DIR__ . '/../..' . '/lib/request/folderchange.php', |
|
| 34 | - 'FolderSync' => __DIR__ . '/../..' . '/lib/request/foldersync.php', |
|
| 35 | - 'FreeBusy' => '/usr/share/php-mapi/class.freebusy.php', |
|
| 36 | - 'GSync' => __DIR__ . '/../..' . '/lib/core/gsync.php', |
|
| 37 | - 'GSyncException' => __DIR__ . '/../..' . '/lib/exceptions/gsyncexception.php', |
|
| 38 | - 'GetAttachment' => __DIR__ . '/../..' . '/lib/request/getattachment.php', |
|
| 39 | - 'GetHierarchy' => __DIR__ . '/../..' . '/lib/request/gethierarchy.php', |
|
| 40 | - 'GetItemEstimate' => __DIR__ . '/../..' . '/lib/request/getitemestimate.php', |
|
| 41 | - 'Grommunio' => __DIR__ . '/../..' . '/lib/grommunio/grommunio.php', |
|
| 42 | - 'HTTPReturnCodeException' => __DIR__ . '/../..' . '/lib/exceptions/httpreturncodeexception.php', |
|
| 43 | - 'HierarchyCache' => __DIR__ . '/../..' . '/lib/core/hierarchycache.php', |
|
| 44 | - 'IBackend' => __DIR__ . '/../..' . '/lib/interface/ibackend.php', |
|
| 45 | - 'IChanges' => __DIR__ . '/../..' . '/lib/interface/ichanges.php', |
|
| 46 | - 'IExportChanges' => __DIR__ . '/../..' . '/lib/interface/iexportchanges.php', |
|
| 47 | - 'IImportChanges' => __DIR__ . '/../..' . '/lib/interface/iimportchanges.php', |
|
| 48 | - 'IIpcProvider' => __DIR__ . '/../..' . '/lib/interface/iipcprovider.php', |
|
| 49 | - 'ISearchProvider' => __DIR__ . '/../..' . '/lib/interface/isearchprovider.php', |
|
| 50 | - 'IStateMachine' => __DIR__ . '/../..' . '/lib/interface/istatemachine.php', |
|
| 51 | - 'ImportChangesICS' => __DIR__ . '/../..' . '/lib/grommunio/importer.php', |
|
| 52 | - 'ImportChangesStream' => __DIR__ . '/../..' . '/lib/core/streamimporter.php', |
|
| 53 | - 'InterProcessData' => __DIR__ . '/../..' . '/lib/core/interprocessdata.php', |
|
| 54 | - 'ItemOperations' => __DIR__ . '/../..' . '/lib/request/itemoperations.php', |
|
| 55 | - 'Log' => __DIR__ . '/../..' . '/lib/log/log.php', |
|
| 56 | - 'LoopDetection' => __DIR__ . '/../..' . '/lib/core/loopdetection.php', |
|
| 57 | - 'MAPIException' => '/usr/share/php-mapi/class.mapiexception.php', |
|
| 58 | - 'MAPIMapping' => __DIR__ . '/../..' . '/lib/grommunio/mapimapping.php', |
|
| 59 | - 'MAPIProvider' => __DIR__ . '/../..' . '/lib/grommunio/mapiprovider.php', |
|
| 60 | - 'MAPIStreamWrapper' => __DIR__ . '/../..' . '/lib/grommunio/mapistreamwrapper.php', |
|
| 61 | - 'MAPIUtils' => __DIR__ . '/../..' . '/lib/grommunio/mapiutils.php', |
|
| 62 | - 'Mail_RFC822' => __DIR__ . '/../..' . '/lib/utils/g_RFC822.php', |
|
| 63 | - 'MeetingResponse' => __DIR__ . '/../..' . '/lib/request/meetingresponse.php', |
|
| 64 | - 'Meetingrequest' => '/usr/share/php-mapi/class.meetingrequest.php', |
|
| 65 | - 'MoveItems' => __DIR__ . '/../..' . '/lib/request/moveitems.php', |
|
| 66 | - 'NoHierarchyCacheAvailableException' => __DIR__ . '/../..' . '/lib/exceptions/nohierarchycacheavailableexception.php', |
|
| 67 | - 'NoPostRequestException' => __DIR__ . '/../..' . '/lib/exceptions/nopostrequestexception.php', |
|
| 68 | - 'NotImplementedException' => __DIR__ . '/../..' . '/lib/exceptions/notimplementedexception.php', |
|
| 69 | - 'Notify' => __DIR__ . '/../..' . '/lib/request/notify.php', |
|
| 70 | - 'PHPWrapper' => __DIR__ . '/../..' . '/lib/grommunio/mapiphpwrapper.php', |
|
| 71 | - 'Ping' => __DIR__ . '/../..' . '/lib/request/ping.php', |
|
| 72 | - 'PingTracking' => __DIR__ . '/../..' . '/lib/core/pingtracking.php', |
|
| 73 | - 'Provisioning' => __DIR__ . '/../..' . '/lib/request/provisioning.php', |
|
| 74 | - 'ProvisioningManager' => __DIR__ . '/../..' . '/lib/core/provisioningmanager.php', |
|
| 75 | - 'ProvisioningRequiredException' => __DIR__ . '/../..' . '/lib/exceptions/provisioningrequiredexception.php', |
|
| 76 | - 'Recurrence' => '/usr/share/php-mapi/class.recurrence.php', |
|
| 77 | - 'RedisConnection' => __DIR__ . '/../..' . '/lib/core/redisconnection.php', |
|
| 78 | - 'ReplaceNullcharFilter' => __DIR__ . '/../..' . '/lib/wbxml/replacenullcharfilter.php', |
|
| 79 | - 'Request' => __DIR__ . '/../..' . '/lib/request/request.php', |
|
| 80 | - 'RequestProcessor' => __DIR__ . '/../..' . '/lib/request/requestprocessor.php', |
|
| 81 | - 'ResolveRecipients' => __DIR__ . '/../..' . '/lib/request/resolverecipients.php', |
|
| 82 | - 'ResponseTrait' => __DIR__ . '/../..' . '/lib/syncobjects/responsetrait.php', |
|
| 83 | - 'SLog' => __DIR__ . '/../..' . '/lib/core/slog.php', |
|
| 84 | - 'Search' => __DIR__ . '/../..' . '/lib/request/search.php', |
|
| 85 | - 'SendMail' => __DIR__ . '/../..' . '/lib/request/sendmail.php', |
|
| 86 | - 'ServiceUnavailableException' => __DIR__ . '/../..' . '/lib/exceptions/serviceunavailableexception.php', |
|
| 87 | - 'Settings' => __DIR__ . '/../..' . '/lib/request/settings.php', |
|
| 88 | - 'SharedFolders' => __DIR__ . '/../..' . '/lib/core/sharedfolders.php', |
|
| 89 | - 'StateInvalidException' => __DIR__ . '/../..' . '/lib/exceptions/stateinvalidexception.php', |
|
| 90 | - 'StateManager' => __DIR__ . '/../..' . '/lib/core/statemanager.php', |
|
| 91 | - 'StateNotFoundException' => __DIR__ . '/../..' . '/lib/exceptions/statenotfoundexception.php', |
|
| 92 | - 'StateNotYetAvailableException' => __DIR__ . '/../..' . '/lib/exceptions/statenotyetavailableexception.php', |
|
| 93 | - 'StateObject' => __DIR__ . '/../..' . '/lib/core/stateobject.php', |
|
| 94 | - 'StatusException' => __DIR__ . '/../..' . '/lib/exceptions/statusexception.php', |
|
| 95 | - 'Streamer' => __DIR__ . '/../..' . '/lib/core/streamer.php', |
|
| 96 | - 'StringStreamWrapper' => __DIR__ . '/../..' . '/lib/utils/stringstreamwrapper.php', |
|
| 97 | - 'Sync' => __DIR__ . '/../..' . '/lib/request/sync.php', |
|
| 98 | - 'SyncAccount' => __DIR__ . '/../..' . '/lib/syncobjects/syncaccount.php', |
|
| 99 | - 'SyncAppointment' => __DIR__ . '/../..' . '/lib/syncobjects/syncappointment.php', |
|
| 100 | - 'SyncAppointmentException' => __DIR__ . '/../..' . '/lib/syncobjects/syncappointmentexception.php', |
|
| 101 | - 'SyncAppointmentResponse' => __DIR__ . '/../..' . '/lib/syncobjects/syncappointment.php', |
|
| 102 | - 'SyncAttachment' => __DIR__ . '/../..' . '/lib/syncobjects/syncattachment.php', |
|
| 103 | - 'SyncAttendee' => __DIR__ . '/../..' . '/lib/syncobjects/syncattendee.php', |
|
| 104 | - 'SyncBaseAttachment' => __DIR__ . '/../..' . '/lib/syncobjects/syncbaseattachment.php', |
|
| 105 | - 'SyncBaseAttachmentAdd' => __DIR__ . '/../..' . '/lib/syncobjects/syncbaseattachment.php', |
|
| 106 | - 'SyncBaseAttachmentDelete' => __DIR__ . '/../..' . '/lib/syncobjects/syncbaseattachment.php', |
|
| 107 | - 'SyncBaseBody' => __DIR__ . '/../..' . '/lib/syncobjects/syncbasebody.php', |
|
| 108 | - 'SyncBaseBodyPart' => __DIR__ . '/../..' . '/lib/syncobjects/syncbasebodypart.php', |
|
| 109 | - 'SyncCollections' => __DIR__ . '/../..' . '/lib/core/synccollections.php', |
|
| 110 | - 'SyncContact' => __DIR__ . '/../..' . '/lib/syncobjects/synccontact.php', |
|
| 111 | - 'SyncContactResponse' => __DIR__ . '/../..' . '/lib/syncobjects/synccontact.php', |
|
| 112 | - 'SyncDeviceInformation' => __DIR__ . '/../..' . '/lib/syncobjects/syncdeviceinformation.php', |
|
| 113 | - 'SyncDevicePassword' => __DIR__ . '/../..' . '/lib/syncobjects/syncdevicepassword.php', |
|
| 114 | - 'SyncEmailAddresses' => __DIR__ . '/../..' . '/lib/syncobjects/syncemailaddresses.php', |
|
| 115 | - 'SyncFindProperties' => __DIR__ . '/../..' . '/lib/syncobjects/syncfindproperties.php', |
|
| 116 | - 'SyncFolder' => __DIR__ . '/../..' . '/lib/syncobjects/syncfolder.php', |
|
| 117 | - 'SyncItemOperationsAttachment' => __DIR__ . '/../..' . '/lib/syncobjects/syncitemoperationsattachment.php', |
|
| 118 | - 'SyncLocation' => __DIR__ . '/../..' . '/lib/syncobjects/synclocation.php', |
|
| 119 | - 'SyncMail' => __DIR__ . '/../..' . '/lib/syncobjects/syncmail.php', |
|
| 120 | - 'SyncMailFlags' => __DIR__ . '/../..' . '/lib/syncobjects/syncmailflags.php', |
|
| 121 | - 'SyncMailResponse' => __DIR__ . '/../..' . '/lib/syncobjects/syncmail.php', |
|
| 122 | - 'SyncMeetingRequest' => __DIR__ . '/../..' . '/lib/syncobjects/syncmeetingrequest.php', |
|
| 123 | - 'SyncMeetingRequestRecurrence' => __DIR__ . '/../..' . '/lib/syncobjects/syncmeetingrequestrecurrence.php', |
|
| 124 | - 'SyncNote' => __DIR__ . '/../..' . '/lib/syncobjects/syncnote.php', |
|
| 125 | - 'SyncNoteResponse' => __DIR__ . '/../..' . '/lib/syncobjects/syncnote.php', |
|
| 126 | - 'SyncOOF' => __DIR__ . '/../..' . '/lib/syncobjects/syncoof.php', |
|
| 127 | - 'SyncOOFMessage' => __DIR__ . '/../..' . '/lib/syncobjects/syncoofmessage.php', |
|
| 128 | - 'SyncObject' => __DIR__ . '/../..' . '/lib/syncobjects/syncobject.php', |
|
| 129 | - 'SyncObjectBrokenException' => __DIR__ . '/../..' . '/lib/exceptions/syncobjectbrokenexception.php', |
|
| 130 | - 'SyncParameters' => __DIR__ . '/../..' . '/lib/core/syncparameters.php', |
|
| 131 | - 'SyncProvisioning' => __DIR__ . '/../..' . '/lib/syncobjects/syncprovisioning.php', |
|
| 132 | - 'SyncRecurrence' => __DIR__ . '/../..' . '/lib/syncobjects/syncrecurrence.php', |
|
| 133 | - 'SyncResolveRecipient' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipient.php', |
|
| 134 | - 'SyncResolveRecipients' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipients.php', |
|
| 135 | - 'SyncResolveRecipientsAvailability' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientsavailability.php', |
|
| 136 | - 'SyncResolveRecipientsCertificates' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientscertificates.php', |
|
| 137 | - 'SyncResolveRecipientsOptions' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientsoptions.php', |
|
| 138 | - 'SyncResolveRecipientsPicture' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientspicture.php', |
|
| 139 | - 'SyncResolveRecipientsResponse' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientsresponse.php', |
|
| 140 | - 'SyncRightsManagementLicense' => __DIR__ . '/../..' . '/lib/syncobjects/syncrightsmanagementlicense.php', |
|
| 141 | - 'SyncRightsManagementTemplate' => __DIR__ . '/../..' . '/lib/syncobjects/syncrightsmanagementtemplate.php', |
|
| 142 | - 'SyncRightsManagementTemplates' => __DIR__ . '/../..' . '/lib/syncobjects/syncrightsmanagementtemplates.php', |
|
| 143 | - 'SyncSendMail' => __DIR__ . '/../..' . '/lib/syncobjects/syncsendmail.php', |
|
| 144 | - 'SyncSendMailSource' => __DIR__ . '/../..' . '/lib/syncobjects/syncsendmailsource.php', |
|
| 145 | - 'SyncTask' => __DIR__ . '/../..' . '/lib/syncobjects/synctask.php', |
|
| 146 | - 'SyncTaskRecurrence' => __DIR__ . '/../..' . '/lib/syncobjects/synctaskrecurrence.php', |
|
| 147 | - 'SyncTaskResponse' => __DIR__ . '/../..' . '/lib/syncobjects/synctask.php', |
|
| 148 | - 'SyncUserInformation' => __DIR__ . '/../..' . '/lib/syncobjects/syncuserinformation.php', |
|
| 149 | - 'SyncValidateCert' => __DIR__ . '/../..' . '/lib/syncobjects/syncvalidatecert.php', |
|
| 150 | - 'Syslog' => __DIR__ . '/../..' . '/lib/log/syslog.php', |
|
| 151 | - 'TaskRecurrence' => '/usr/share/php-mapi/class.taskrecurrence.php', |
|
| 152 | - 'TaskRequest' => '/usr/share/php-mapi/class.taskrequest.php', |
|
| 153 | - 'TimezoneUtil' => __DIR__ . '/../..' . '/lib/utils/timezoneutil.php', |
|
| 154 | - 'TopCollector' => __DIR__ . '/../..' . '/lib/core/topcollector.php', |
|
| 155 | - 'UnavailableException' => __DIR__ . '/../..' . '/lib/exceptions/unavailableexception.php', |
|
| 156 | - 'UserStoreInfo' => __DIR__ . '/../..' . '/lib/core/userstoreinfo.php', |
|
| 157 | - 'Utils' => __DIR__ . '/../..' . '/lib/utils/utils.php', |
|
| 158 | - 'ValidateCert' => __DIR__ . '/../..' . '/lib/request/validatecert.php', |
|
| 159 | - 'WBXMLDecoder' => __DIR__ . '/../..' . '/lib/wbxml/wbxmldecoder.php', |
|
| 160 | - 'WBXMLDefs' => __DIR__ . '/../..' . '/lib/wbxml/wbxmldefs.php', |
|
| 161 | - 'WBXMLEncoder' => __DIR__ . '/../..' . '/lib/wbxml/wbxmlencoder.php', |
|
| 162 | - 'WBXMLException' => __DIR__ . '/../..' . '/lib/exceptions/wbxmlexception.php', |
|
| 163 | - ); |
|
| 15 | + public static $classMap = array ( |
|
| 16 | + 'ASDevice' => __DIR__ . '/../..' . '/lib/core/asdevice.php', |
|
| 17 | + 'AuthenticationRequiredException' => __DIR__ . '/../..' . '/lib/exceptions/authenticationrequiredexception.php', |
|
| 18 | + 'BaseException' => '/usr/share/php-mapi/class.baseexception.php', |
|
| 19 | + 'BaseRecurrence' => '/usr/share/php-mapi/class.baserecurrence.php', |
|
| 20 | + 'BodyPartPreference' => __DIR__ . '/../..' . '/lib/core/bodypartpreference.php', |
|
| 21 | + 'BodyPreference' => __DIR__ . '/../..' . '/lib/core/bodypreference.php', |
|
| 22 | + 'ChangesMemoryWrapper' => __DIR__ . '/../..' . '/lib/core/changesmemorywrapper.php', |
|
| 23 | + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
|
| 24 | + 'ConnectionTracking' => __DIR__ . '/../..' . '/lib/core/connectiontracking.php', |
|
| 25 | + 'ContentParameters' => __DIR__ . '/../..' . '/lib/core/contentparameters.php', |
|
| 26 | + 'DeviceManager' => __DIR__ . '/../..' . '/lib/core/devicemanager.php', |
|
| 27 | + 'ExportChangesICS' => __DIR__ . '/../..' . '/lib/grommunio/exporter.php', |
|
| 28 | + 'FatalException' => __DIR__ . '/../..' . '/lib/exceptions/fatalexception.php', |
|
| 29 | + 'FatalMisconfigurationException' => __DIR__ . '/../..' . '/lib/exceptions/fatalmisconfigurationexception.php', |
|
| 30 | + 'FatalNotImplementedException' => __DIR__ . '/../..' . '/lib/exceptions/fatalnotimplementedexception.php', |
|
| 31 | + 'FileLog' => __DIR__ . '/../..' . '/lib/log/filelog.php', |
|
| 32 | + 'Find' => __DIR__ . '/../..' . '/lib/request/find.php', |
|
| 33 | + 'FolderChange' => __DIR__ . '/../..' . '/lib/request/folderchange.php', |
|
| 34 | + 'FolderSync' => __DIR__ . '/../..' . '/lib/request/foldersync.php', |
|
| 35 | + 'FreeBusy' => '/usr/share/php-mapi/class.freebusy.php', |
|
| 36 | + 'GSync' => __DIR__ . '/../..' . '/lib/core/gsync.php', |
|
| 37 | + 'GSyncException' => __DIR__ . '/../..' . '/lib/exceptions/gsyncexception.php', |
|
| 38 | + 'GetAttachment' => __DIR__ . '/../..' . '/lib/request/getattachment.php', |
|
| 39 | + 'GetHierarchy' => __DIR__ . '/../..' . '/lib/request/gethierarchy.php', |
|
| 40 | + 'GetItemEstimate' => __DIR__ . '/../..' . '/lib/request/getitemestimate.php', |
|
| 41 | + 'Grommunio' => __DIR__ . '/../..' . '/lib/grommunio/grommunio.php', |
|
| 42 | + 'HTTPReturnCodeException' => __DIR__ . '/../..' . '/lib/exceptions/httpreturncodeexception.php', |
|
| 43 | + 'HierarchyCache' => __DIR__ . '/../..' . '/lib/core/hierarchycache.php', |
|
| 44 | + 'IBackend' => __DIR__ . '/../..' . '/lib/interface/ibackend.php', |
|
| 45 | + 'IChanges' => __DIR__ . '/../..' . '/lib/interface/ichanges.php', |
|
| 46 | + 'IExportChanges' => __DIR__ . '/../..' . '/lib/interface/iexportchanges.php', |
|
| 47 | + 'IImportChanges' => __DIR__ . '/../..' . '/lib/interface/iimportchanges.php', |
|
| 48 | + 'IIpcProvider' => __DIR__ . '/../..' . '/lib/interface/iipcprovider.php', |
|
| 49 | + 'ISearchProvider' => __DIR__ . '/../..' . '/lib/interface/isearchprovider.php', |
|
| 50 | + 'IStateMachine' => __DIR__ . '/../..' . '/lib/interface/istatemachine.php', |
|
| 51 | + 'ImportChangesICS' => __DIR__ . '/../..' . '/lib/grommunio/importer.php', |
|
| 52 | + 'ImportChangesStream' => __DIR__ . '/../..' . '/lib/core/streamimporter.php', |
|
| 53 | + 'InterProcessData' => __DIR__ . '/../..' . '/lib/core/interprocessdata.php', |
|
| 54 | + 'ItemOperations' => __DIR__ . '/../..' . '/lib/request/itemoperations.php', |
|
| 55 | + 'Log' => __DIR__ . '/../..' . '/lib/log/log.php', |
|
| 56 | + 'LoopDetection' => __DIR__ . '/../..' . '/lib/core/loopdetection.php', |
|
| 57 | + 'MAPIException' => '/usr/share/php-mapi/class.mapiexception.php', |
|
| 58 | + 'MAPIMapping' => __DIR__ . '/../..' . '/lib/grommunio/mapimapping.php', |
|
| 59 | + 'MAPIProvider' => __DIR__ . '/../..' . '/lib/grommunio/mapiprovider.php', |
|
| 60 | + 'MAPIStreamWrapper' => __DIR__ . '/../..' . '/lib/grommunio/mapistreamwrapper.php', |
|
| 61 | + 'MAPIUtils' => __DIR__ . '/../..' . '/lib/grommunio/mapiutils.php', |
|
| 62 | + 'Mail_RFC822' => __DIR__ . '/../..' . '/lib/utils/g_RFC822.php', |
|
| 63 | + 'MeetingResponse' => __DIR__ . '/../..' . '/lib/request/meetingresponse.php', |
|
| 64 | + 'Meetingrequest' => '/usr/share/php-mapi/class.meetingrequest.php', |
|
| 65 | + 'MoveItems' => __DIR__ . '/../..' . '/lib/request/moveitems.php', |
|
| 66 | + 'NoHierarchyCacheAvailableException' => __DIR__ . '/../..' . '/lib/exceptions/nohierarchycacheavailableexception.php', |
|
| 67 | + 'NoPostRequestException' => __DIR__ . '/../..' . '/lib/exceptions/nopostrequestexception.php', |
|
| 68 | + 'NotImplementedException' => __DIR__ . '/../..' . '/lib/exceptions/notimplementedexception.php', |
|
| 69 | + 'Notify' => __DIR__ . '/../..' . '/lib/request/notify.php', |
|
| 70 | + 'PHPWrapper' => __DIR__ . '/../..' . '/lib/grommunio/mapiphpwrapper.php', |
|
| 71 | + 'Ping' => __DIR__ . '/../..' . '/lib/request/ping.php', |
|
| 72 | + 'PingTracking' => __DIR__ . '/../..' . '/lib/core/pingtracking.php', |
|
| 73 | + 'Provisioning' => __DIR__ . '/../..' . '/lib/request/provisioning.php', |
|
| 74 | + 'ProvisioningManager' => __DIR__ . '/../..' . '/lib/core/provisioningmanager.php', |
|
| 75 | + 'ProvisioningRequiredException' => __DIR__ . '/../..' . '/lib/exceptions/provisioningrequiredexception.php', |
|
| 76 | + 'Recurrence' => '/usr/share/php-mapi/class.recurrence.php', |
|
| 77 | + 'RedisConnection' => __DIR__ . '/../..' . '/lib/core/redisconnection.php', |
|
| 78 | + 'ReplaceNullcharFilter' => __DIR__ . '/../..' . '/lib/wbxml/replacenullcharfilter.php', |
|
| 79 | + 'Request' => __DIR__ . '/../..' . '/lib/request/request.php', |
|
| 80 | + 'RequestProcessor' => __DIR__ . '/../..' . '/lib/request/requestprocessor.php', |
|
| 81 | + 'ResolveRecipients' => __DIR__ . '/../..' . '/lib/request/resolverecipients.php', |
|
| 82 | + 'ResponseTrait' => __DIR__ . '/../..' . '/lib/syncobjects/responsetrait.php', |
|
| 83 | + 'SLog' => __DIR__ . '/../..' . '/lib/core/slog.php', |
|
| 84 | + 'Search' => __DIR__ . '/../..' . '/lib/request/search.php', |
|
| 85 | + 'SendMail' => __DIR__ . '/../..' . '/lib/request/sendmail.php', |
|
| 86 | + 'ServiceUnavailableException' => __DIR__ . '/../..' . '/lib/exceptions/serviceunavailableexception.php', |
|
| 87 | + 'Settings' => __DIR__ . '/../..' . '/lib/request/settings.php', |
|
| 88 | + 'SharedFolders' => __DIR__ . '/../..' . '/lib/core/sharedfolders.php', |
|
| 89 | + 'StateInvalidException' => __DIR__ . '/../..' . '/lib/exceptions/stateinvalidexception.php', |
|
| 90 | + 'StateManager' => __DIR__ . '/../..' . '/lib/core/statemanager.php', |
|
| 91 | + 'StateNotFoundException' => __DIR__ . '/../..' . '/lib/exceptions/statenotfoundexception.php', |
|
| 92 | + 'StateNotYetAvailableException' => __DIR__ . '/../..' . '/lib/exceptions/statenotyetavailableexception.php', |
|
| 93 | + 'StateObject' => __DIR__ . '/../..' . '/lib/core/stateobject.php', |
|
| 94 | + 'StatusException' => __DIR__ . '/../..' . '/lib/exceptions/statusexception.php', |
|
| 95 | + 'Streamer' => __DIR__ . '/../..' . '/lib/core/streamer.php', |
|
| 96 | + 'StringStreamWrapper' => __DIR__ . '/../..' . '/lib/utils/stringstreamwrapper.php', |
|
| 97 | + 'Sync' => __DIR__ . '/../..' . '/lib/request/sync.php', |
|
| 98 | + 'SyncAccount' => __DIR__ . '/../..' . '/lib/syncobjects/syncaccount.php', |
|
| 99 | + 'SyncAppointment' => __DIR__ . '/../..' . '/lib/syncobjects/syncappointment.php', |
|
| 100 | + 'SyncAppointmentException' => __DIR__ . '/../..' . '/lib/syncobjects/syncappointmentexception.php', |
|
| 101 | + 'SyncAppointmentResponse' => __DIR__ . '/../..' . '/lib/syncobjects/syncappointment.php', |
|
| 102 | + 'SyncAttachment' => __DIR__ . '/../..' . '/lib/syncobjects/syncattachment.php', |
|
| 103 | + 'SyncAttendee' => __DIR__ . '/../..' . '/lib/syncobjects/syncattendee.php', |
|
| 104 | + 'SyncBaseAttachment' => __DIR__ . '/../..' . '/lib/syncobjects/syncbaseattachment.php', |
|
| 105 | + 'SyncBaseAttachmentAdd' => __DIR__ . '/../..' . '/lib/syncobjects/syncbaseattachment.php', |
|
| 106 | + 'SyncBaseAttachmentDelete' => __DIR__ . '/../..' . '/lib/syncobjects/syncbaseattachment.php', |
|
| 107 | + 'SyncBaseBody' => __DIR__ . '/../..' . '/lib/syncobjects/syncbasebody.php', |
|
| 108 | + 'SyncBaseBodyPart' => __DIR__ . '/../..' . '/lib/syncobjects/syncbasebodypart.php', |
|
| 109 | + 'SyncCollections' => __DIR__ . '/../..' . '/lib/core/synccollections.php', |
|
| 110 | + 'SyncContact' => __DIR__ . '/../..' . '/lib/syncobjects/synccontact.php', |
|
| 111 | + 'SyncContactResponse' => __DIR__ . '/../..' . '/lib/syncobjects/synccontact.php', |
|
| 112 | + 'SyncDeviceInformation' => __DIR__ . '/../..' . '/lib/syncobjects/syncdeviceinformation.php', |
|
| 113 | + 'SyncDevicePassword' => __DIR__ . '/../..' . '/lib/syncobjects/syncdevicepassword.php', |
|
| 114 | + 'SyncEmailAddresses' => __DIR__ . '/../..' . '/lib/syncobjects/syncemailaddresses.php', |
|
| 115 | + 'SyncFindProperties' => __DIR__ . '/../..' . '/lib/syncobjects/syncfindproperties.php', |
|
| 116 | + 'SyncFolder' => __DIR__ . '/../..' . '/lib/syncobjects/syncfolder.php', |
|
| 117 | + 'SyncItemOperationsAttachment' => __DIR__ . '/../..' . '/lib/syncobjects/syncitemoperationsattachment.php', |
|
| 118 | + 'SyncLocation' => __DIR__ . '/../..' . '/lib/syncobjects/synclocation.php', |
|
| 119 | + 'SyncMail' => __DIR__ . '/../..' . '/lib/syncobjects/syncmail.php', |
|
| 120 | + 'SyncMailFlags' => __DIR__ . '/../..' . '/lib/syncobjects/syncmailflags.php', |
|
| 121 | + 'SyncMailResponse' => __DIR__ . '/../..' . '/lib/syncobjects/syncmail.php', |
|
| 122 | + 'SyncMeetingRequest' => __DIR__ . '/../..' . '/lib/syncobjects/syncmeetingrequest.php', |
|
| 123 | + 'SyncMeetingRequestRecurrence' => __DIR__ . '/../..' . '/lib/syncobjects/syncmeetingrequestrecurrence.php', |
|
| 124 | + 'SyncNote' => __DIR__ . '/../..' . '/lib/syncobjects/syncnote.php', |
|
| 125 | + 'SyncNoteResponse' => __DIR__ . '/../..' . '/lib/syncobjects/syncnote.php', |
|
| 126 | + 'SyncOOF' => __DIR__ . '/../..' . '/lib/syncobjects/syncoof.php', |
|
| 127 | + 'SyncOOFMessage' => __DIR__ . '/../..' . '/lib/syncobjects/syncoofmessage.php', |
|
| 128 | + 'SyncObject' => __DIR__ . '/../..' . '/lib/syncobjects/syncobject.php', |
|
| 129 | + 'SyncObjectBrokenException' => __DIR__ . '/../..' . '/lib/exceptions/syncobjectbrokenexception.php', |
|
| 130 | + 'SyncParameters' => __DIR__ . '/../..' . '/lib/core/syncparameters.php', |
|
| 131 | + 'SyncProvisioning' => __DIR__ . '/../..' . '/lib/syncobjects/syncprovisioning.php', |
|
| 132 | + 'SyncRecurrence' => __DIR__ . '/../..' . '/lib/syncobjects/syncrecurrence.php', |
|
| 133 | + 'SyncResolveRecipient' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipient.php', |
|
| 134 | + 'SyncResolveRecipients' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipients.php', |
|
| 135 | + 'SyncResolveRecipientsAvailability' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientsavailability.php', |
|
| 136 | + 'SyncResolveRecipientsCertificates' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientscertificates.php', |
|
| 137 | + 'SyncResolveRecipientsOptions' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientsoptions.php', |
|
| 138 | + 'SyncResolveRecipientsPicture' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientspicture.php', |
|
| 139 | + 'SyncResolveRecipientsResponse' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientsresponse.php', |
|
| 140 | + 'SyncRightsManagementLicense' => __DIR__ . '/../..' . '/lib/syncobjects/syncrightsmanagementlicense.php', |
|
| 141 | + 'SyncRightsManagementTemplate' => __DIR__ . '/../..' . '/lib/syncobjects/syncrightsmanagementtemplate.php', |
|
| 142 | + 'SyncRightsManagementTemplates' => __DIR__ . '/../..' . '/lib/syncobjects/syncrightsmanagementtemplates.php', |
|
| 143 | + 'SyncSendMail' => __DIR__ . '/../..' . '/lib/syncobjects/syncsendmail.php', |
|
| 144 | + 'SyncSendMailSource' => __DIR__ . '/../..' . '/lib/syncobjects/syncsendmailsource.php', |
|
| 145 | + 'SyncTask' => __DIR__ . '/../..' . '/lib/syncobjects/synctask.php', |
|
| 146 | + 'SyncTaskRecurrence' => __DIR__ . '/../..' . '/lib/syncobjects/synctaskrecurrence.php', |
|
| 147 | + 'SyncTaskResponse' => __DIR__ . '/../..' . '/lib/syncobjects/synctask.php', |
|
| 148 | + 'SyncUserInformation' => __DIR__ . '/../..' . '/lib/syncobjects/syncuserinformation.php', |
|
| 149 | + 'SyncValidateCert' => __DIR__ . '/../..' . '/lib/syncobjects/syncvalidatecert.php', |
|
| 150 | + 'Syslog' => __DIR__ . '/../..' . '/lib/log/syslog.php', |
|
| 151 | + 'TaskRecurrence' => '/usr/share/php-mapi/class.taskrecurrence.php', |
|
| 152 | + 'TaskRequest' => '/usr/share/php-mapi/class.taskrequest.php', |
|
| 153 | + 'TimezoneUtil' => __DIR__ . '/../..' . '/lib/utils/timezoneutil.php', |
|
| 154 | + 'TopCollector' => __DIR__ . '/../..' . '/lib/core/topcollector.php', |
|
| 155 | + 'UnavailableException' => __DIR__ . '/../..' . '/lib/exceptions/unavailableexception.php', |
|
| 156 | + 'UserStoreInfo' => __DIR__ . '/../..' . '/lib/core/userstoreinfo.php', |
|
| 157 | + 'Utils' => __DIR__ . '/../..' . '/lib/utils/utils.php', |
|
| 158 | + 'ValidateCert' => __DIR__ . '/../..' . '/lib/request/validatecert.php', |
|
| 159 | + 'WBXMLDecoder' => __DIR__ . '/../..' . '/lib/wbxml/wbxmldecoder.php', |
|
| 160 | + 'WBXMLDefs' => __DIR__ . '/../..' . '/lib/wbxml/wbxmldefs.php', |
|
| 161 | + 'WBXMLEncoder' => __DIR__ . '/../..' . '/lib/wbxml/wbxmlencoder.php', |
|
| 162 | + 'WBXMLException' => __DIR__ . '/../..' . '/lib/exceptions/wbxmlexception.php', |
|
| 163 | + ); |
|
| 164 | 164 | |
| 165 | - public static function getInitializer(ClassLoader $loader) |
|
| 166 | - { |
|
| 167 | - return \Closure::bind(function () use ($loader) { |
|
| 168 | - $loader->classMap = ComposerStaticInit153a56a781a72686b71399955d98204f::$classMap; |
|
| 165 | + public static function getInitializer(ClassLoader $loader) |
|
| 166 | + { |
|
| 167 | + return \Closure::bind(function () use ($loader) { |
|
| 168 | + $loader->classMap = ComposerStaticInit153a56a781a72686b71399955d98204f::$classMap; |
|
| 169 | 169 | |
| 170 | - }, null, ClassLoader::class); |
|
| 171 | - } |
|
| 170 | + }, null, ClassLoader::class); |
|
| 171 | + } |
|
| 172 | 172 | } |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | $baseDir = dirname($vendorDir); |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - '158e247719544c05f5e89c414f630c24' => $baseDir . '/version.php', |
|
| 10 | - 'f2969980cdf0dddd210ef5448430b9c0' => $baseDir . '/lib/core/gsyncdefs.php', |
|
| 11 | - 'd2a63a53b4a43a2bd71de0cec5c1abfb' => $baseDir . '/lib/utils/compat.php', |
|
| 9 | + '158e247719544c05f5e89c414f630c24' => $baseDir . '/version.php', |
|
| 10 | + 'f2969980cdf0dddd210ef5448430b9c0' => $baseDir . '/lib/core/gsyncdefs.php', |
|
| 11 | + 'd2a63a53b4a43a2bd71de0cec5c1abfb' => $baseDir . '/lib/utils/compat.php', |
|
| 12 | 12 | ); |
@@ -42,538 +42,538 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | class ClassLoader |
| 44 | 44 | { |
| 45 | - /** @var \Closure(string):void */ |
|
| 46 | - private static $includeFile; |
|
| 47 | - |
|
| 48 | - /** @var string|null */ |
|
| 49 | - private $vendorDir; |
|
| 50 | - |
|
| 51 | - // PSR-4 |
|
| 52 | - /** |
|
| 53 | - * @var array<string, array<string, int>> |
|
| 54 | - */ |
|
| 55 | - private $prefixLengthsPsr4 = array(); |
|
| 56 | - /** |
|
| 57 | - * @var array<string, list<string>> |
|
| 58 | - */ |
|
| 59 | - private $prefixDirsPsr4 = array(); |
|
| 60 | - /** |
|
| 61 | - * @var list<string> |
|
| 62 | - */ |
|
| 63 | - private $fallbackDirsPsr4 = array(); |
|
| 64 | - |
|
| 65 | - // PSR-0 |
|
| 66 | - /** |
|
| 67 | - * List of PSR-0 prefixes |
|
| 68 | - * |
|
| 69 | - * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) |
|
| 70 | - * |
|
| 71 | - * @var array<string, array<string, list<string>>> |
|
| 72 | - */ |
|
| 73 | - private $prefixesPsr0 = array(); |
|
| 74 | - /** |
|
| 75 | - * @var list<string> |
|
| 76 | - */ |
|
| 77 | - private $fallbackDirsPsr0 = array(); |
|
| 78 | - |
|
| 79 | - /** @var bool */ |
|
| 80 | - private $useIncludePath = false; |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * @var array<string, string> |
|
| 84 | - */ |
|
| 85 | - private $classMap = array(); |
|
| 86 | - |
|
| 87 | - /** @var bool */ |
|
| 88 | - private $classMapAuthoritative = false; |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * @var array<string, bool> |
|
| 92 | - */ |
|
| 93 | - private $missingClasses = array(); |
|
| 94 | - |
|
| 95 | - /** @var string|null */ |
|
| 96 | - private $apcuPrefix; |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @var array<string, self> |
|
| 100 | - */ |
|
| 101 | - private static $registeredLoaders = array(); |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * @param string|null $vendorDir |
|
| 105 | - */ |
|
| 106 | - public function __construct($vendorDir = null) |
|
| 107 | - { |
|
| 108 | - $this->vendorDir = $vendorDir; |
|
| 109 | - self::initializeIncludeClosure(); |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * @return array<string, list<string>> |
|
| 114 | - */ |
|
| 115 | - public function getPrefixes() |
|
| 116 | - { |
|
| 117 | - if (!empty($this->prefixesPsr0)) { |
|
| 118 | - return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - return array(); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * @return array<string, list<string>> |
|
| 126 | - */ |
|
| 127 | - public function getPrefixesPsr4() |
|
| 128 | - { |
|
| 129 | - return $this->prefixDirsPsr4; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * @return list<string> |
|
| 134 | - */ |
|
| 135 | - public function getFallbackDirs() |
|
| 136 | - { |
|
| 137 | - return $this->fallbackDirsPsr0; |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * @return list<string> |
|
| 142 | - */ |
|
| 143 | - public function getFallbackDirsPsr4() |
|
| 144 | - { |
|
| 145 | - return $this->fallbackDirsPsr4; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * @return array<string, string> Array of classname => path |
|
| 150 | - */ |
|
| 151 | - public function getClassMap() |
|
| 152 | - { |
|
| 153 | - return $this->classMap; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * @param array<string, string> $classMap Class to filename map |
|
| 158 | - * |
|
| 159 | - * @return void |
|
| 160 | - */ |
|
| 161 | - public function addClassMap(array $classMap) |
|
| 162 | - { |
|
| 163 | - if ($this->classMap) { |
|
| 164 | - $this->classMap = array_merge($this->classMap, $classMap); |
|
| 165 | - } else { |
|
| 166 | - $this->classMap = $classMap; |
|
| 167 | - } |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Registers a set of PSR-0 directories for a given prefix, either |
|
| 172 | - * appending or prepending to the ones previously set for this prefix. |
|
| 173 | - * |
|
| 174 | - * @param string $prefix The prefix |
|
| 175 | - * @param list<string>|string $paths The PSR-0 root directories |
|
| 176 | - * @param bool $prepend Whether to prepend the directories |
|
| 177 | - * |
|
| 178 | - * @return void |
|
| 179 | - */ |
|
| 180 | - public function add($prefix, $paths, $prepend = false) |
|
| 181 | - { |
|
| 182 | - $paths = (array) $paths; |
|
| 183 | - if (!$prefix) { |
|
| 184 | - if ($prepend) { |
|
| 185 | - $this->fallbackDirsPsr0 = array_merge( |
|
| 186 | - $paths, |
|
| 187 | - $this->fallbackDirsPsr0 |
|
| 188 | - ); |
|
| 189 | - } else { |
|
| 190 | - $this->fallbackDirsPsr0 = array_merge( |
|
| 191 | - $this->fallbackDirsPsr0, |
|
| 192 | - $paths |
|
| 193 | - ); |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - return; |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - $first = $prefix[0]; |
|
| 200 | - if (!isset($this->prefixesPsr0[$first][$prefix])) { |
|
| 201 | - $this->prefixesPsr0[$first][$prefix] = $paths; |
|
| 202 | - |
|
| 203 | - return; |
|
| 204 | - } |
|
| 205 | - if ($prepend) { |
|
| 206 | - $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
| 207 | - $paths, |
|
| 208 | - $this->prefixesPsr0[$first][$prefix] |
|
| 209 | - ); |
|
| 210 | - } else { |
|
| 211 | - $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
| 212 | - $this->prefixesPsr0[$first][$prefix], |
|
| 213 | - $paths |
|
| 214 | - ); |
|
| 215 | - } |
|
| 216 | - } |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * Registers a set of PSR-4 directories for a given namespace, either |
|
| 220 | - * appending or prepending to the ones previously set for this namespace. |
|
| 221 | - * |
|
| 222 | - * @param string $prefix The prefix/namespace, with trailing '\\' |
|
| 223 | - * @param list<string>|string $paths The PSR-4 base directories |
|
| 224 | - * @param bool $prepend Whether to prepend the directories |
|
| 225 | - * |
|
| 226 | - * @throws \InvalidArgumentException |
|
| 227 | - * |
|
| 228 | - * @return void |
|
| 229 | - */ |
|
| 230 | - public function addPsr4($prefix, $paths, $prepend = false) |
|
| 231 | - { |
|
| 232 | - $paths = (array) $paths; |
|
| 233 | - if (!$prefix) { |
|
| 234 | - // Register directories for the root namespace. |
|
| 235 | - if ($prepend) { |
|
| 236 | - $this->fallbackDirsPsr4 = array_merge( |
|
| 237 | - $paths, |
|
| 238 | - $this->fallbackDirsPsr4 |
|
| 239 | - ); |
|
| 240 | - } else { |
|
| 241 | - $this->fallbackDirsPsr4 = array_merge( |
|
| 242 | - $this->fallbackDirsPsr4, |
|
| 243 | - $paths |
|
| 244 | - ); |
|
| 245 | - } |
|
| 246 | - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
| 247 | - // Register directories for a new namespace. |
|
| 248 | - $length = strlen($prefix); |
|
| 249 | - if ('\\' !== $prefix[$length - 1]) { |
|
| 250 | - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
| 251 | - } |
|
| 252 | - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
| 253 | - $this->prefixDirsPsr4[$prefix] = $paths; |
|
| 254 | - } elseif ($prepend) { |
|
| 255 | - // Prepend directories for an already registered namespace. |
|
| 256 | - $this->prefixDirsPsr4[$prefix] = array_merge( |
|
| 257 | - $paths, |
|
| 258 | - $this->prefixDirsPsr4[$prefix] |
|
| 259 | - ); |
|
| 260 | - } else { |
|
| 261 | - // Append directories for an already registered namespace. |
|
| 262 | - $this->prefixDirsPsr4[$prefix] = array_merge( |
|
| 263 | - $this->prefixDirsPsr4[$prefix], |
|
| 264 | - $paths |
|
| 265 | - ); |
|
| 266 | - } |
|
| 267 | - } |
|
| 268 | - |
|
| 269 | - /** |
|
| 270 | - * Registers a set of PSR-0 directories for a given prefix, |
|
| 271 | - * replacing any others previously set for this prefix. |
|
| 272 | - * |
|
| 273 | - * @param string $prefix The prefix |
|
| 274 | - * @param list<string>|string $paths The PSR-0 base directories |
|
| 275 | - * |
|
| 276 | - * @return void |
|
| 277 | - */ |
|
| 278 | - public function set($prefix, $paths) |
|
| 279 | - { |
|
| 280 | - if (!$prefix) { |
|
| 281 | - $this->fallbackDirsPsr0 = (array) $paths; |
|
| 282 | - } else { |
|
| 283 | - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; |
|
| 284 | - } |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - /** |
|
| 288 | - * Registers a set of PSR-4 directories for a given namespace, |
|
| 289 | - * replacing any others previously set for this namespace. |
|
| 290 | - * |
|
| 291 | - * @param string $prefix The prefix/namespace, with trailing '\\' |
|
| 292 | - * @param list<string>|string $paths The PSR-4 base directories |
|
| 293 | - * |
|
| 294 | - * @throws \InvalidArgumentException |
|
| 295 | - * |
|
| 296 | - * @return void |
|
| 297 | - */ |
|
| 298 | - public function setPsr4($prefix, $paths) |
|
| 299 | - { |
|
| 300 | - if (!$prefix) { |
|
| 301 | - $this->fallbackDirsPsr4 = (array) $paths; |
|
| 302 | - } else { |
|
| 303 | - $length = strlen($prefix); |
|
| 304 | - if ('\\' !== $prefix[$length - 1]) { |
|
| 305 | - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
| 306 | - } |
|
| 307 | - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
| 308 | - $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
| 309 | - } |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * Turns on searching the include path for class files. |
|
| 314 | - * |
|
| 315 | - * @param bool $useIncludePath |
|
| 316 | - * |
|
| 317 | - * @return void |
|
| 318 | - */ |
|
| 319 | - public function setUseIncludePath($useIncludePath) |
|
| 320 | - { |
|
| 321 | - $this->useIncludePath = $useIncludePath; |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - /** |
|
| 325 | - * Can be used to check if the autoloader uses the include path to check |
|
| 326 | - * for classes. |
|
| 327 | - * |
|
| 328 | - * @return bool |
|
| 329 | - */ |
|
| 330 | - public function getUseIncludePath() |
|
| 331 | - { |
|
| 332 | - return $this->useIncludePath; |
|
| 333 | - } |
|
| 334 | - |
|
| 335 | - /** |
|
| 336 | - * Turns off searching the prefix and fallback directories for classes |
|
| 337 | - * that have not been registered with the class map. |
|
| 338 | - * |
|
| 339 | - * @param bool $classMapAuthoritative |
|
| 340 | - * |
|
| 341 | - * @return void |
|
| 342 | - */ |
|
| 343 | - public function setClassMapAuthoritative($classMapAuthoritative) |
|
| 344 | - { |
|
| 345 | - $this->classMapAuthoritative = $classMapAuthoritative; |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - /** |
|
| 349 | - * Should class lookup fail if not found in the current class map? |
|
| 350 | - * |
|
| 351 | - * @return bool |
|
| 352 | - */ |
|
| 353 | - public function isClassMapAuthoritative() |
|
| 354 | - { |
|
| 355 | - return $this->classMapAuthoritative; |
|
| 356 | - } |
|
| 357 | - |
|
| 358 | - /** |
|
| 359 | - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. |
|
| 360 | - * |
|
| 361 | - * @param string|null $apcuPrefix |
|
| 362 | - * |
|
| 363 | - * @return void |
|
| 364 | - */ |
|
| 365 | - public function setApcuPrefix($apcuPrefix) |
|
| 366 | - { |
|
| 367 | - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; |
|
| 368 | - } |
|
| 369 | - |
|
| 370 | - /** |
|
| 371 | - * The APCu prefix in use, or null if APCu caching is not enabled. |
|
| 372 | - * |
|
| 373 | - * @return string|null |
|
| 374 | - */ |
|
| 375 | - public function getApcuPrefix() |
|
| 376 | - { |
|
| 377 | - return $this->apcuPrefix; |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - /** |
|
| 381 | - * Registers this instance as an autoloader. |
|
| 382 | - * |
|
| 383 | - * @param bool $prepend Whether to prepend the autoloader or not |
|
| 384 | - * |
|
| 385 | - * @return void |
|
| 386 | - */ |
|
| 387 | - public function register($prepend = false) |
|
| 388 | - { |
|
| 389 | - spl_autoload_register(array($this, 'loadClass'), true, $prepend); |
|
| 390 | - |
|
| 391 | - if (null === $this->vendorDir) { |
|
| 392 | - return; |
|
| 393 | - } |
|
| 394 | - |
|
| 395 | - if ($prepend) { |
|
| 396 | - self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; |
|
| 397 | - } else { |
|
| 398 | - unset(self::$registeredLoaders[$this->vendorDir]); |
|
| 399 | - self::$registeredLoaders[$this->vendorDir] = $this; |
|
| 400 | - } |
|
| 401 | - } |
|
| 402 | - |
|
| 403 | - /** |
|
| 404 | - * Unregisters this instance as an autoloader. |
|
| 405 | - * |
|
| 406 | - * @return void |
|
| 407 | - */ |
|
| 408 | - public function unregister() |
|
| 409 | - { |
|
| 410 | - spl_autoload_unregister(array($this, 'loadClass')); |
|
| 411 | - |
|
| 412 | - if (null !== $this->vendorDir) { |
|
| 413 | - unset(self::$registeredLoaders[$this->vendorDir]); |
|
| 414 | - } |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - /** |
|
| 418 | - * Loads the given class or interface. |
|
| 419 | - * |
|
| 420 | - * @param string $class The name of the class |
|
| 421 | - * @return true|null True if loaded, null otherwise |
|
| 422 | - */ |
|
| 423 | - public function loadClass($class) |
|
| 424 | - { |
|
| 425 | - if ($file = $this->findFile($class)) { |
|
| 426 | - $includeFile = self::$includeFile; |
|
| 427 | - $includeFile($file); |
|
| 428 | - |
|
| 429 | - return true; |
|
| 430 | - } |
|
| 431 | - |
|
| 432 | - return null; |
|
| 433 | - } |
|
| 434 | - |
|
| 435 | - /** |
|
| 436 | - * Finds the path to the file where the class is defined. |
|
| 437 | - * |
|
| 438 | - * @param string $class The name of the class |
|
| 439 | - * |
|
| 440 | - * @return string|false The path if found, false otherwise |
|
| 441 | - */ |
|
| 442 | - public function findFile($class) |
|
| 443 | - { |
|
| 444 | - // class map lookup |
|
| 445 | - if (isset($this->classMap[$class])) { |
|
| 446 | - return $this->classMap[$class]; |
|
| 447 | - } |
|
| 448 | - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { |
|
| 449 | - return false; |
|
| 450 | - } |
|
| 451 | - if (null !== $this->apcuPrefix) { |
|
| 452 | - $file = apcu_fetch($this->apcuPrefix.$class, $hit); |
|
| 453 | - if ($hit) { |
|
| 454 | - return $file; |
|
| 455 | - } |
|
| 456 | - } |
|
| 457 | - |
|
| 458 | - $file = $this->findFileWithExtension($class, '.php'); |
|
| 459 | - |
|
| 460 | - // Search for Hack files if we are running on HHVM |
|
| 461 | - if (false === $file && defined('HHVM_VERSION')) { |
|
| 462 | - $file = $this->findFileWithExtension($class, '.hh'); |
|
| 463 | - } |
|
| 464 | - |
|
| 465 | - if (null !== $this->apcuPrefix) { |
|
| 466 | - apcu_add($this->apcuPrefix.$class, $file); |
|
| 467 | - } |
|
| 468 | - |
|
| 469 | - if (false === $file) { |
|
| 470 | - // Remember that this class does not exist. |
|
| 471 | - $this->missingClasses[$class] = true; |
|
| 472 | - } |
|
| 473 | - |
|
| 474 | - return $file; |
|
| 475 | - } |
|
| 476 | - |
|
| 477 | - /** |
|
| 478 | - * Returns the currently registered loaders keyed by their corresponding vendor directories. |
|
| 479 | - * |
|
| 480 | - * @return array<string, self> |
|
| 481 | - */ |
|
| 482 | - public static function getRegisteredLoaders() |
|
| 483 | - { |
|
| 484 | - return self::$registeredLoaders; |
|
| 485 | - } |
|
| 486 | - |
|
| 487 | - /** |
|
| 488 | - * @param string $class |
|
| 489 | - * @param string $ext |
|
| 490 | - * @return string|false |
|
| 491 | - */ |
|
| 492 | - private function findFileWithExtension($class, $ext) |
|
| 493 | - { |
|
| 494 | - // PSR-4 lookup |
|
| 495 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
| 496 | - |
|
| 497 | - $first = $class[0]; |
|
| 498 | - if (isset($this->prefixLengthsPsr4[$first])) { |
|
| 499 | - $subPath = $class; |
|
| 500 | - while (false !== $lastPos = strrpos($subPath, '\\')) { |
|
| 501 | - $subPath = substr($subPath, 0, $lastPos); |
|
| 502 | - $search = $subPath . '\\'; |
|
| 503 | - if (isset($this->prefixDirsPsr4[$search])) { |
|
| 504 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
| 505 | - foreach ($this->prefixDirsPsr4[$search] as $dir) { |
|
| 506 | - if (file_exists($file = $dir . $pathEnd)) { |
|
| 507 | - return $file; |
|
| 508 | - } |
|
| 509 | - } |
|
| 510 | - } |
|
| 511 | - } |
|
| 512 | - } |
|
| 513 | - |
|
| 514 | - // PSR-4 fallback dirs |
|
| 515 | - foreach ($this->fallbackDirsPsr4 as $dir) { |
|
| 516 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
| 517 | - return $file; |
|
| 518 | - } |
|
| 519 | - } |
|
| 520 | - |
|
| 521 | - // PSR-0 lookup |
|
| 522 | - if (false !== $pos = strrpos($class, '\\')) { |
|
| 523 | - // namespaced class name |
|
| 524 | - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) |
|
| 525 | - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
|
| 526 | - } else { |
|
| 527 | - // PEAR-like class name |
|
| 528 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
| 529 | - } |
|
| 530 | - |
|
| 531 | - if (isset($this->prefixesPsr0[$first])) { |
|
| 532 | - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
|
| 533 | - if (0 === strpos($class, $prefix)) { |
|
| 534 | - foreach ($dirs as $dir) { |
|
| 535 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 536 | - return $file; |
|
| 537 | - } |
|
| 538 | - } |
|
| 539 | - } |
|
| 540 | - } |
|
| 541 | - } |
|
| 542 | - |
|
| 543 | - // PSR-0 fallback dirs |
|
| 544 | - foreach ($this->fallbackDirsPsr0 as $dir) { |
|
| 545 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 546 | - return $file; |
|
| 547 | - } |
|
| 548 | - } |
|
| 549 | - |
|
| 550 | - // PSR-0 include paths. |
|
| 551 | - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { |
|
| 552 | - return $file; |
|
| 553 | - } |
|
| 554 | - |
|
| 555 | - return false; |
|
| 556 | - } |
|
| 557 | - |
|
| 558 | - /** |
|
| 559 | - * @return void |
|
| 560 | - */ |
|
| 561 | - private static function initializeIncludeClosure() |
|
| 562 | - { |
|
| 563 | - if (self::$includeFile !== null) { |
|
| 564 | - return; |
|
| 565 | - } |
|
| 566 | - |
|
| 567 | - /** |
|
| 568 | - * Scope isolated include. |
|
| 569 | - * |
|
| 570 | - * Prevents access to $this/self from included files. |
|
| 571 | - * |
|
| 572 | - * @param string $file |
|
| 573 | - * @return void |
|
| 574 | - */ |
|
| 575 | - self::$includeFile = \Closure::bind(static function($file) { |
|
| 576 | - include $file; |
|
| 577 | - }, null, null); |
|
| 578 | - } |
|
| 45 | + /** @var \Closure(string):void */ |
|
| 46 | + private static $includeFile; |
|
| 47 | + |
|
| 48 | + /** @var string|null */ |
|
| 49 | + private $vendorDir; |
|
| 50 | + |
|
| 51 | + // PSR-4 |
|
| 52 | + /** |
|
| 53 | + * @var array<string, array<string, int>> |
|
| 54 | + */ |
|
| 55 | + private $prefixLengthsPsr4 = array(); |
|
| 56 | + /** |
|
| 57 | + * @var array<string, list<string>> |
|
| 58 | + */ |
|
| 59 | + private $prefixDirsPsr4 = array(); |
|
| 60 | + /** |
|
| 61 | + * @var list<string> |
|
| 62 | + */ |
|
| 63 | + private $fallbackDirsPsr4 = array(); |
|
| 64 | + |
|
| 65 | + // PSR-0 |
|
| 66 | + /** |
|
| 67 | + * List of PSR-0 prefixes |
|
| 68 | + * |
|
| 69 | + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) |
|
| 70 | + * |
|
| 71 | + * @var array<string, array<string, list<string>>> |
|
| 72 | + */ |
|
| 73 | + private $prefixesPsr0 = array(); |
|
| 74 | + /** |
|
| 75 | + * @var list<string> |
|
| 76 | + */ |
|
| 77 | + private $fallbackDirsPsr0 = array(); |
|
| 78 | + |
|
| 79 | + /** @var bool */ |
|
| 80 | + private $useIncludePath = false; |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @var array<string, string> |
|
| 84 | + */ |
|
| 85 | + private $classMap = array(); |
|
| 86 | + |
|
| 87 | + /** @var bool */ |
|
| 88 | + private $classMapAuthoritative = false; |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * @var array<string, bool> |
|
| 92 | + */ |
|
| 93 | + private $missingClasses = array(); |
|
| 94 | + |
|
| 95 | + /** @var string|null */ |
|
| 96 | + private $apcuPrefix; |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * @var array<string, self> |
|
| 100 | + */ |
|
| 101 | + private static $registeredLoaders = array(); |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * @param string|null $vendorDir |
|
| 105 | + */ |
|
| 106 | + public function __construct($vendorDir = null) |
|
| 107 | + { |
|
| 108 | + $this->vendorDir = $vendorDir; |
|
| 109 | + self::initializeIncludeClosure(); |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * @return array<string, list<string>> |
|
| 114 | + */ |
|
| 115 | + public function getPrefixes() |
|
| 116 | + { |
|
| 117 | + if (!empty($this->prefixesPsr0)) { |
|
| 118 | + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + return array(); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * @return array<string, list<string>> |
|
| 126 | + */ |
|
| 127 | + public function getPrefixesPsr4() |
|
| 128 | + { |
|
| 129 | + return $this->prefixDirsPsr4; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * @return list<string> |
|
| 134 | + */ |
|
| 135 | + public function getFallbackDirs() |
|
| 136 | + { |
|
| 137 | + return $this->fallbackDirsPsr0; |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * @return list<string> |
|
| 142 | + */ |
|
| 143 | + public function getFallbackDirsPsr4() |
|
| 144 | + { |
|
| 145 | + return $this->fallbackDirsPsr4; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * @return array<string, string> Array of classname => path |
|
| 150 | + */ |
|
| 151 | + public function getClassMap() |
|
| 152 | + { |
|
| 153 | + return $this->classMap; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * @param array<string, string> $classMap Class to filename map |
|
| 158 | + * |
|
| 159 | + * @return void |
|
| 160 | + */ |
|
| 161 | + public function addClassMap(array $classMap) |
|
| 162 | + { |
|
| 163 | + if ($this->classMap) { |
|
| 164 | + $this->classMap = array_merge($this->classMap, $classMap); |
|
| 165 | + } else { |
|
| 166 | + $this->classMap = $classMap; |
|
| 167 | + } |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Registers a set of PSR-0 directories for a given prefix, either |
|
| 172 | + * appending or prepending to the ones previously set for this prefix. |
|
| 173 | + * |
|
| 174 | + * @param string $prefix The prefix |
|
| 175 | + * @param list<string>|string $paths The PSR-0 root directories |
|
| 176 | + * @param bool $prepend Whether to prepend the directories |
|
| 177 | + * |
|
| 178 | + * @return void |
|
| 179 | + */ |
|
| 180 | + public function add($prefix, $paths, $prepend = false) |
|
| 181 | + { |
|
| 182 | + $paths = (array) $paths; |
|
| 183 | + if (!$prefix) { |
|
| 184 | + if ($prepend) { |
|
| 185 | + $this->fallbackDirsPsr0 = array_merge( |
|
| 186 | + $paths, |
|
| 187 | + $this->fallbackDirsPsr0 |
|
| 188 | + ); |
|
| 189 | + } else { |
|
| 190 | + $this->fallbackDirsPsr0 = array_merge( |
|
| 191 | + $this->fallbackDirsPsr0, |
|
| 192 | + $paths |
|
| 193 | + ); |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + return; |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + $first = $prefix[0]; |
|
| 200 | + if (!isset($this->prefixesPsr0[$first][$prefix])) { |
|
| 201 | + $this->prefixesPsr0[$first][$prefix] = $paths; |
|
| 202 | + |
|
| 203 | + return; |
|
| 204 | + } |
|
| 205 | + if ($prepend) { |
|
| 206 | + $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
| 207 | + $paths, |
|
| 208 | + $this->prefixesPsr0[$first][$prefix] |
|
| 209 | + ); |
|
| 210 | + } else { |
|
| 211 | + $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
| 212 | + $this->prefixesPsr0[$first][$prefix], |
|
| 213 | + $paths |
|
| 214 | + ); |
|
| 215 | + } |
|
| 216 | + } |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * Registers a set of PSR-4 directories for a given namespace, either |
|
| 220 | + * appending or prepending to the ones previously set for this namespace. |
|
| 221 | + * |
|
| 222 | + * @param string $prefix The prefix/namespace, with trailing '\\' |
|
| 223 | + * @param list<string>|string $paths The PSR-4 base directories |
|
| 224 | + * @param bool $prepend Whether to prepend the directories |
|
| 225 | + * |
|
| 226 | + * @throws \InvalidArgumentException |
|
| 227 | + * |
|
| 228 | + * @return void |
|
| 229 | + */ |
|
| 230 | + public function addPsr4($prefix, $paths, $prepend = false) |
|
| 231 | + { |
|
| 232 | + $paths = (array) $paths; |
|
| 233 | + if (!$prefix) { |
|
| 234 | + // Register directories for the root namespace. |
|
| 235 | + if ($prepend) { |
|
| 236 | + $this->fallbackDirsPsr4 = array_merge( |
|
| 237 | + $paths, |
|
| 238 | + $this->fallbackDirsPsr4 |
|
| 239 | + ); |
|
| 240 | + } else { |
|
| 241 | + $this->fallbackDirsPsr4 = array_merge( |
|
| 242 | + $this->fallbackDirsPsr4, |
|
| 243 | + $paths |
|
| 244 | + ); |
|
| 245 | + } |
|
| 246 | + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
| 247 | + // Register directories for a new namespace. |
|
| 248 | + $length = strlen($prefix); |
|
| 249 | + if ('\\' !== $prefix[$length - 1]) { |
|
| 250 | + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
| 251 | + } |
|
| 252 | + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
| 253 | + $this->prefixDirsPsr4[$prefix] = $paths; |
|
| 254 | + } elseif ($prepend) { |
|
| 255 | + // Prepend directories for an already registered namespace. |
|
| 256 | + $this->prefixDirsPsr4[$prefix] = array_merge( |
|
| 257 | + $paths, |
|
| 258 | + $this->prefixDirsPsr4[$prefix] |
|
| 259 | + ); |
|
| 260 | + } else { |
|
| 261 | + // Append directories for an already registered namespace. |
|
| 262 | + $this->prefixDirsPsr4[$prefix] = array_merge( |
|
| 263 | + $this->prefixDirsPsr4[$prefix], |
|
| 264 | + $paths |
|
| 265 | + ); |
|
| 266 | + } |
|
| 267 | + } |
|
| 268 | + |
|
| 269 | + /** |
|
| 270 | + * Registers a set of PSR-0 directories for a given prefix, |
|
| 271 | + * replacing any others previously set for this prefix. |
|
| 272 | + * |
|
| 273 | + * @param string $prefix The prefix |
|
| 274 | + * @param list<string>|string $paths The PSR-0 base directories |
|
| 275 | + * |
|
| 276 | + * @return void |
|
| 277 | + */ |
|
| 278 | + public function set($prefix, $paths) |
|
| 279 | + { |
|
| 280 | + if (!$prefix) { |
|
| 281 | + $this->fallbackDirsPsr0 = (array) $paths; |
|
| 282 | + } else { |
|
| 283 | + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; |
|
| 284 | + } |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + /** |
|
| 288 | + * Registers a set of PSR-4 directories for a given namespace, |
|
| 289 | + * replacing any others previously set for this namespace. |
|
| 290 | + * |
|
| 291 | + * @param string $prefix The prefix/namespace, with trailing '\\' |
|
| 292 | + * @param list<string>|string $paths The PSR-4 base directories |
|
| 293 | + * |
|
| 294 | + * @throws \InvalidArgumentException |
|
| 295 | + * |
|
| 296 | + * @return void |
|
| 297 | + */ |
|
| 298 | + public function setPsr4($prefix, $paths) |
|
| 299 | + { |
|
| 300 | + if (!$prefix) { |
|
| 301 | + $this->fallbackDirsPsr4 = (array) $paths; |
|
| 302 | + } else { |
|
| 303 | + $length = strlen($prefix); |
|
| 304 | + if ('\\' !== $prefix[$length - 1]) { |
|
| 305 | + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
|
| 306 | + } |
|
| 307 | + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
| 308 | + $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * Turns on searching the include path for class files. |
|
| 314 | + * |
|
| 315 | + * @param bool $useIncludePath |
|
| 316 | + * |
|
| 317 | + * @return void |
|
| 318 | + */ |
|
| 319 | + public function setUseIncludePath($useIncludePath) |
|
| 320 | + { |
|
| 321 | + $this->useIncludePath = $useIncludePath; |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + /** |
|
| 325 | + * Can be used to check if the autoloader uses the include path to check |
|
| 326 | + * for classes. |
|
| 327 | + * |
|
| 328 | + * @return bool |
|
| 329 | + */ |
|
| 330 | + public function getUseIncludePath() |
|
| 331 | + { |
|
| 332 | + return $this->useIncludePath; |
|
| 333 | + } |
|
| 334 | + |
|
| 335 | + /** |
|
| 336 | + * Turns off searching the prefix and fallback directories for classes |
|
| 337 | + * that have not been registered with the class map. |
|
| 338 | + * |
|
| 339 | + * @param bool $classMapAuthoritative |
|
| 340 | + * |
|
| 341 | + * @return void |
|
| 342 | + */ |
|
| 343 | + public function setClassMapAuthoritative($classMapAuthoritative) |
|
| 344 | + { |
|
| 345 | + $this->classMapAuthoritative = $classMapAuthoritative; |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + /** |
|
| 349 | + * Should class lookup fail if not found in the current class map? |
|
| 350 | + * |
|
| 351 | + * @return bool |
|
| 352 | + */ |
|
| 353 | + public function isClassMapAuthoritative() |
|
| 354 | + { |
|
| 355 | + return $this->classMapAuthoritative; |
|
| 356 | + } |
|
| 357 | + |
|
| 358 | + /** |
|
| 359 | + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. |
|
| 360 | + * |
|
| 361 | + * @param string|null $apcuPrefix |
|
| 362 | + * |
|
| 363 | + * @return void |
|
| 364 | + */ |
|
| 365 | + public function setApcuPrefix($apcuPrefix) |
|
| 366 | + { |
|
| 367 | + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; |
|
| 368 | + } |
|
| 369 | + |
|
| 370 | + /** |
|
| 371 | + * The APCu prefix in use, or null if APCu caching is not enabled. |
|
| 372 | + * |
|
| 373 | + * @return string|null |
|
| 374 | + */ |
|
| 375 | + public function getApcuPrefix() |
|
| 376 | + { |
|
| 377 | + return $this->apcuPrefix; |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * Registers this instance as an autoloader. |
|
| 382 | + * |
|
| 383 | + * @param bool $prepend Whether to prepend the autoloader or not |
|
| 384 | + * |
|
| 385 | + * @return void |
|
| 386 | + */ |
|
| 387 | + public function register($prepend = false) |
|
| 388 | + { |
|
| 389 | + spl_autoload_register(array($this, 'loadClass'), true, $prepend); |
|
| 390 | + |
|
| 391 | + if (null === $this->vendorDir) { |
|
| 392 | + return; |
|
| 393 | + } |
|
| 394 | + |
|
| 395 | + if ($prepend) { |
|
| 396 | + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; |
|
| 397 | + } else { |
|
| 398 | + unset(self::$registeredLoaders[$this->vendorDir]); |
|
| 399 | + self::$registeredLoaders[$this->vendorDir] = $this; |
|
| 400 | + } |
|
| 401 | + } |
|
| 402 | + |
|
| 403 | + /** |
|
| 404 | + * Unregisters this instance as an autoloader. |
|
| 405 | + * |
|
| 406 | + * @return void |
|
| 407 | + */ |
|
| 408 | + public function unregister() |
|
| 409 | + { |
|
| 410 | + spl_autoload_unregister(array($this, 'loadClass')); |
|
| 411 | + |
|
| 412 | + if (null !== $this->vendorDir) { |
|
| 413 | + unset(self::$registeredLoaders[$this->vendorDir]); |
|
| 414 | + } |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + /** |
|
| 418 | + * Loads the given class or interface. |
|
| 419 | + * |
|
| 420 | + * @param string $class The name of the class |
|
| 421 | + * @return true|null True if loaded, null otherwise |
|
| 422 | + */ |
|
| 423 | + public function loadClass($class) |
|
| 424 | + { |
|
| 425 | + if ($file = $this->findFile($class)) { |
|
| 426 | + $includeFile = self::$includeFile; |
|
| 427 | + $includeFile($file); |
|
| 428 | + |
|
| 429 | + return true; |
|
| 430 | + } |
|
| 431 | + |
|
| 432 | + return null; |
|
| 433 | + } |
|
| 434 | + |
|
| 435 | + /** |
|
| 436 | + * Finds the path to the file where the class is defined. |
|
| 437 | + * |
|
| 438 | + * @param string $class The name of the class |
|
| 439 | + * |
|
| 440 | + * @return string|false The path if found, false otherwise |
|
| 441 | + */ |
|
| 442 | + public function findFile($class) |
|
| 443 | + { |
|
| 444 | + // class map lookup |
|
| 445 | + if (isset($this->classMap[$class])) { |
|
| 446 | + return $this->classMap[$class]; |
|
| 447 | + } |
|
| 448 | + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { |
|
| 449 | + return false; |
|
| 450 | + } |
|
| 451 | + if (null !== $this->apcuPrefix) { |
|
| 452 | + $file = apcu_fetch($this->apcuPrefix.$class, $hit); |
|
| 453 | + if ($hit) { |
|
| 454 | + return $file; |
|
| 455 | + } |
|
| 456 | + } |
|
| 457 | + |
|
| 458 | + $file = $this->findFileWithExtension($class, '.php'); |
|
| 459 | + |
|
| 460 | + // Search for Hack files if we are running on HHVM |
|
| 461 | + if (false === $file && defined('HHVM_VERSION')) { |
|
| 462 | + $file = $this->findFileWithExtension($class, '.hh'); |
|
| 463 | + } |
|
| 464 | + |
|
| 465 | + if (null !== $this->apcuPrefix) { |
|
| 466 | + apcu_add($this->apcuPrefix.$class, $file); |
|
| 467 | + } |
|
| 468 | + |
|
| 469 | + if (false === $file) { |
|
| 470 | + // Remember that this class does not exist. |
|
| 471 | + $this->missingClasses[$class] = true; |
|
| 472 | + } |
|
| 473 | + |
|
| 474 | + return $file; |
|
| 475 | + } |
|
| 476 | + |
|
| 477 | + /** |
|
| 478 | + * Returns the currently registered loaders keyed by their corresponding vendor directories. |
|
| 479 | + * |
|
| 480 | + * @return array<string, self> |
|
| 481 | + */ |
|
| 482 | + public static function getRegisteredLoaders() |
|
| 483 | + { |
|
| 484 | + return self::$registeredLoaders; |
|
| 485 | + } |
|
| 486 | + |
|
| 487 | + /** |
|
| 488 | + * @param string $class |
|
| 489 | + * @param string $ext |
|
| 490 | + * @return string|false |
|
| 491 | + */ |
|
| 492 | + private function findFileWithExtension($class, $ext) |
|
| 493 | + { |
|
| 494 | + // PSR-4 lookup |
|
| 495 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
| 496 | + |
|
| 497 | + $first = $class[0]; |
|
| 498 | + if (isset($this->prefixLengthsPsr4[$first])) { |
|
| 499 | + $subPath = $class; |
|
| 500 | + while (false !== $lastPos = strrpos($subPath, '\\')) { |
|
| 501 | + $subPath = substr($subPath, 0, $lastPos); |
|
| 502 | + $search = $subPath . '\\'; |
|
| 503 | + if (isset($this->prefixDirsPsr4[$search])) { |
|
| 504 | + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
| 505 | + foreach ($this->prefixDirsPsr4[$search] as $dir) { |
|
| 506 | + if (file_exists($file = $dir . $pathEnd)) { |
|
| 507 | + return $file; |
|
| 508 | + } |
|
| 509 | + } |
|
| 510 | + } |
|
| 511 | + } |
|
| 512 | + } |
|
| 513 | + |
|
| 514 | + // PSR-4 fallback dirs |
|
| 515 | + foreach ($this->fallbackDirsPsr4 as $dir) { |
|
| 516 | + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
| 517 | + return $file; |
|
| 518 | + } |
|
| 519 | + } |
|
| 520 | + |
|
| 521 | + // PSR-0 lookup |
|
| 522 | + if (false !== $pos = strrpos($class, '\\')) { |
|
| 523 | + // namespaced class name |
|
| 524 | + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) |
|
| 525 | + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
|
| 526 | + } else { |
|
| 527 | + // PEAR-like class name |
|
| 528 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
| 529 | + } |
|
| 530 | + |
|
| 531 | + if (isset($this->prefixesPsr0[$first])) { |
|
| 532 | + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
|
| 533 | + if (0 === strpos($class, $prefix)) { |
|
| 534 | + foreach ($dirs as $dir) { |
|
| 535 | + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 536 | + return $file; |
|
| 537 | + } |
|
| 538 | + } |
|
| 539 | + } |
|
| 540 | + } |
|
| 541 | + } |
|
| 542 | + |
|
| 543 | + // PSR-0 fallback dirs |
|
| 544 | + foreach ($this->fallbackDirsPsr0 as $dir) { |
|
| 545 | + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 546 | + return $file; |
|
| 547 | + } |
|
| 548 | + } |
|
| 549 | + |
|
| 550 | + // PSR-0 include paths. |
|
| 551 | + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { |
|
| 552 | + return $file; |
|
| 553 | + } |
|
| 554 | + |
|
| 555 | + return false; |
|
| 556 | + } |
|
| 557 | + |
|
| 558 | + /** |
|
| 559 | + * @return void |
|
| 560 | + */ |
|
| 561 | + private static function initializeIncludeClosure() |
|
| 562 | + { |
|
| 563 | + if (self::$includeFile !== null) { |
|
| 564 | + return; |
|
| 565 | + } |
|
| 566 | + |
|
| 567 | + /** |
|
| 568 | + * Scope isolated include. |
|
| 569 | + * |
|
| 570 | + * Prevents access to $this/self from included files. |
|
| 571 | + * |
|
| 572 | + * @param string $file |
|
| 573 | + * @return void |
|
| 574 | + */ |
|
| 575 | + self::$includeFile = \Closure::bind(static function($file) { |
|
| 576 | + include $file; |
|
| 577 | + }, null, null); |
|
| 578 | + } |
|
| 579 | 579 | } |
@@ -103,8 +103,7 @@ discard block |
||
| 103 | 103 | /** |
| 104 | 104 | * @param string|null $vendorDir |
| 105 | 105 | */ |
| 106 | - public function __construct($vendorDir = null) |
|
| 107 | - { |
|
| 106 | + public function __construct($vendorDir = null) { |
|
| 108 | 107 | $this->vendorDir = $vendorDir; |
| 109 | 108 | self::initializeIncludeClosure(); |
| 110 | 109 | } |
@@ -112,8 +111,7 @@ discard block |
||
| 112 | 111 | /** |
| 113 | 112 | * @return array<string, list<string>> |
| 114 | 113 | */ |
| 115 | - public function getPrefixes() |
|
| 116 | - { |
|
| 114 | + public function getPrefixes() { |
|
| 117 | 115 | if (!empty($this->prefixesPsr0)) { |
| 118 | 116 | return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); |
| 119 | 117 | } |
@@ -124,32 +122,28 @@ discard block |
||
| 124 | 122 | /** |
| 125 | 123 | * @return array<string, list<string>> |
| 126 | 124 | */ |
| 127 | - public function getPrefixesPsr4() |
|
| 128 | - { |
|
| 125 | + public function getPrefixesPsr4() { |
|
| 129 | 126 | return $this->prefixDirsPsr4; |
| 130 | 127 | } |
| 131 | 128 | |
| 132 | 129 | /** |
| 133 | 130 | * @return list<string> |
| 134 | 131 | */ |
| 135 | - public function getFallbackDirs() |
|
| 136 | - { |
|
| 132 | + public function getFallbackDirs() { |
|
| 137 | 133 | return $this->fallbackDirsPsr0; |
| 138 | 134 | } |
| 139 | 135 | |
| 140 | 136 | /** |
| 141 | 137 | * @return list<string> |
| 142 | 138 | */ |
| 143 | - public function getFallbackDirsPsr4() |
|
| 144 | - { |
|
| 139 | + public function getFallbackDirsPsr4() { |
|
| 145 | 140 | return $this->fallbackDirsPsr4; |
| 146 | 141 | } |
| 147 | 142 | |
| 148 | 143 | /** |
| 149 | 144 | * @return array<string, string> Array of classname => path |
| 150 | 145 | */ |
| 151 | - public function getClassMap() |
|
| 152 | - { |
|
| 146 | + public function getClassMap() { |
|
| 153 | 147 | return $this->classMap; |
| 154 | 148 | } |
| 155 | 149 | |
@@ -158,11 +152,11 @@ discard block |
||
| 158 | 152 | * |
| 159 | 153 | * @return void |
| 160 | 154 | */ |
| 161 | - public function addClassMap(array $classMap) |
|
| 162 | - { |
|
| 155 | + public function addClassMap(array $classMap) { |
|
| 163 | 156 | if ($this->classMap) { |
| 164 | 157 | $this->classMap = array_merge($this->classMap, $classMap); |
| 165 | - } else { |
|
| 158 | + } |
|
| 159 | + else { |
|
| 166 | 160 | $this->classMap = $classMap; |
| 167 | 161 | } |
| 168 | 162 | } |
@@ -177,8 +171,7 @@ discard block |
||
| 177 | 171 | * |
| 178 | 172 | * @return void |
| 179 | 173 | */ |
| 180 | - public function add($prefix, $paths, $prepend = false) |
|
| 181 | - { |
|
| 174 | + public function add($prefix, $paths, $prepend = false) { |
|
| 182 | 175 | $paths = (array) $paths; |
| 183 | 176 | if (!$prefix) { |
| 184 | 177 | if ($prepend) { |
@@ -186,7 +179,8 @@ discard block |
||
| 186 | 179 | $paths, |
| 187 | 180 | $this->fallbackDirsPsr0 |
| 188 | 181 | ); |
| 189 | - } else { |
|
| 182 | + } |
|
| 183 | + else { |
|
| 190 | 184 | $this->fallbackDirsPsr0 = array_merge( |
| 191 | 185 | $this->fallbackDirsPsr0, |
| 192 | 186 | $paths |
@@ -207,7 +201,8 @@ discard block |
||
| 207 | 201 | $paths, |
| 208 | 202 | $this->prefixesPsr0[$first][$prefix] |
| 209 | 203 | ); |
| 210 | - } else { |
|
| 204 | + } |
|
| 205 | + else { |
|
| 211 | 206 | $this->prefixesPsr0[$first][$prefix] = array_merge( |
| 212 | 207 | $this->prefixesPsr0[$first][$prefix], |
| 213 | 208 | $paths |
@@ -227,8 +222,7 @@ discard block |
||
| 227 | 222 | * |
| 228 | 223 | * @return void |
| 229 | 224 | */ |
| 230 | - public function addPsr4($prefix, $paths, $prepend = false) |
|
| 231 | - { |
|
| 225 | + public function addPsr4($prefix, $paths, $prepend = false) { |
|
| 232 | 226 | $paths = (array) $paths; |
| 233 | 227 | if (!$prefix) { |
| 234 | 228 | // Register directories for the root namespace. |
@@ -237,13 +231,15 @@ discard block |
||
| 237 | 231 | $paths, |
| 238 | 232 | $this->fallbackDirsPsr4 |
| 239 | 233 | ); |
| 240 | - } else { |
|
| 234 | + } |
|
| 235 | + else { |
|
| 241 | 236 | $this->fallbackDirsPsr4 = array_merge( |
| 242 | 237 | $this->fallbackDirsPsr4, |
| 243 | 238 | $paths |
| 244 | 239 | ); |
| 245 | 240 | } |
| 246 | - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
| 241 | + } |
|
| 242 | + elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
| 247 | 243 | // Register directories for a new namespace. |
| 248 | 244 | $length = strlen($prefix); |
| 249 | 245 | if ('\\' !== $prefix[$length - 1]) { |
@@ -251,13 +247,15 @@ discard block |
||
| 251 | 247 | } |
| 252 | 248 | $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
| 253 | 249 | $this->prefixDirsPsr4[$prefix] = $paths; |
| 254 | - } elseif ($prepend) { |
|
| 250 | + } |
|
| 251 | + elseif ($prepend) { |
|
| 255 | 252 | // Prepend directories for an already registered namespace. |
| 256 | 253 | $this->prefixDirsPsr4[$prefix] = array_merge( |
| 257 | 254 | $paths, |
| 258 | 255 | $this->prefixDirsPsr4[$prefix] |
| 259 | 256 | ); |
| 260 | - } else { |
|
| 257 | + } |
|
| 258 | + else { |
|
| 261 | 259 | // Append directories for an already registered namespace. |
| 262 | 260 | $this->prefixDirsPsr4[$prefix] = array_merge( |
| 263 | 261 | $this->prefixDirsPsr4[$prefix], |
@@ -275,11 +273,11 @@ discard block |
||
| 275 | 273 | * |
| 276 | 274 | * @return void |
| 277 | 275 | */ |
| 278 | - public function set($prefix, $paths) |
|
| 279 | - { |
|
| 276 | + public function set($prefix, $paths) { |
|
| 280 | 277 | if (!$prefix) { |
| 281 | 278 | $this->fallbackDirsPsr0 = (array) $paths; |
| 282 | - } else { |
|
| 279 | + } |
|
| 280 | + else { |
|
| 283 | 281 | $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; |
| 284 | 282 | } |
| 285 | 283 | } |
@@ -295,11 +293,11 @@ discard block |
||
| 295 | 293 | * |
| 296 | 294 | * @return void |
| 297 | 295 | */ |
| 298 | - public function setPsr4($prefix, $paths) |
|
| 299 | - { |
|
| 296 | + public function setPsr4($prefix, $paths) { |
|
| 300 | 297 | if (!$prefix) { |
| 301 | 298 | $this->fallbackDirsPsr4 = (array) $paths; |
| 302 | - } else { |
|
| 299 | + } |
|
| 300 | + else { |
|
| 303 | 301 | $length = strlen($prefix); |
| 304 | 302 | if ('\\' !== $prefix[$length - 1]) { |
| 305 | 303 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
@@ -316,8 +314,7 @@ discard block |
||
| 316 | 314 | * |
| 317 | 315 | * @return void |
| 318 | 316 | */ |
| 319 | - public function setUseIncludePath($useIncludePath) |
|
| 320 | - { |
|
| 317 | + public function setUseIncludePath($useIncludePath) { |
|
| 321 | 318 | $this->useIncludePath = $useIncludePath; |
| 322 | 319 | } |
| 323 | 320 | |
@@ -327,8 +324,7 @@ discard block |
||
| 327 | 324 | * |
| 328 | 325 | * @return bool |
| 329 | 326 | */ |
| 330 | - public function getUseIncludePath() |
|
| 331 | - { |
|
| 327 | + public function getUseIncludePath() { |
|
| 332 | 328 | return $this->useIncludePath; |
| 333 | 329 | } |
| 334 | 330 | |
@@ -340,8 +336,7 @@ discard block |
||
| 340 | 336 | * |
| 341 | 337 | * @return void |
| 342 | 338 | */ |
| 343 | - public function setClassMapAuthoritative($classMapAuthoritative) |
|
| 344 | - { |
|
| 339 | + public function setClassMapAuthoritative($classMapAuthoritative) { |
|
| 345 | 340 | $this->classMapAuthoritative = $classMapAuthoritative; |
| 346 | 341 | } |
| 347 | 342 | |
@@ -350,8 +345,7 @@ discard block |
||
| 350 | 345 | * |
| 351 | 346 | * @return bool |
| 352 | 347 | */ |
| 353 | - public function isClassMapAuthoritative() |
|
| 354 | - { |
|
| 348 | + public function isClassMapAuthoritative() { |
|
| 355 | 349 | return $this->classMapAuthoritative; |
| 356 | 350 | } |
| 357 | 351 | |
@@ -362,8 +356,7 @@ discard block |
||
| 362 | 356 | * |
| 363 | 357 | * @return void |
| 364 | 358 | */ |
| 365 | - public function setApcuPrefix($apcuPrefix) |
|
| 366 | - { |
|
| 359 | + public function setApcuPrefix($apcuPrefix) { |
|
| 367 | 360 | $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; |
| 368 | 361 | } |
| 369 | 362 | |
@@ -372,8 +365,7 @@ discard block |
||
| 372 | 365 | * |
| 373 | 366 | * @return string|null |
| 374 | 367 | */ |
| 375 | - public function getApcuPrefix() |
|
| 376 | - { |
|
| 368 | + public function getApcuPrefix() { |
|
| 377 | 369 | return $this->apcuPrefix; |
| 378 | 370 | } |
| 379 | 371 | |
@@ -384,8 +376,7 @@ discard block |
||
| 384 | 376 | * |
| 385 | 377 | * @return void |
| 386 | 378 | */ |
| 387 | - public function register($prepend = false) |
|
| 388 | - { |
|
| 379 | + public function register($prepend = false) { |
|
| 389 | 380 | spl_autoload_register(array($this, 'loadClass'), true, $prepend); |
| 390 | 381 | |
| 391 | 382 | if (null === $this->vendorDir) { |
@@ -394,7 +385,8 @@ discard block |
||
| 394 | 385 | |
| 395 | 386 | if ($prepend) { |
| 396 | 387 | self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; |
| 397 | - } else { |
|
| 388 | + } |
|
| 389 | + else { |
|
| 398 | 390 | unset(self::$registeredLoaders[$this->vendorDir]); |
| 399 | 391 | self::$registeredLoaders[$this->vendorDir] = $this; |
| 400 | 392 | } |
@@ -405,8 +397,7 @@ discard block |
||
| 405 | 397 | * |
| 406 | 398 | * @return void |
| 407 | 399 | */ |
| 408 | - public function unregister() |
|
| 409 | - { |
|
| 400 | + public function unregister() { |
|
| 410 | 401 | spl_autoload_unregister(array($this, 'loadClass')); |
| 411 | 402 | |
| 412 | 403 | if (null !== $this->vendorDir) { |
@@ -420,8 +411,7 @@ discard block |
||
| 420 | 411 | * @param string $class The name of the class |
| 421 | 412 | * @return true|null True if loaded, null otherwise |
| 422 | 413 | */ |
| 423 | - public function loadClass($class) |
|
| 424 | - { |
|
| 414 | + public function loadClass($class) { |
|
| 425 | 415 | if ($file = $this->findFile($class)) { |
| 426 | 416 | $includeFile = self::$includeFile; |
| 427 | 417 | $includeFile($file); |
@@ -439,8 +429,7 @@ discard block |
||
| 439 | 429 | * |
| 440 | 430 | * @return string|false The path if found, false otherwise |
| 441 | 431 | */ |
| 442 | - public function findFile($class) |
|
| 443 | - { |
|
| 432 | + public function findFile($class) { |
|
| 444 | 433 | // class map lookup |
| 445 | 434 | if (isset($this->classMap[$class])) { |
| 446 | 435 | return $this->classMap[$class]; |
@@ -479,8 +468,7 @@ discard block |
||
| 479 | 468 | * |
| 480 | 469 | * @return array<string, self> |
| 481 | 470 | */ |
| 482 | - public static function getRegisteredLoaders() |
|
| 483 | - { |
|
| 471 | + public static function getRegisteredLoaders() { |
|
| 484 | 472 | return self::$registeredLoaders; |
| 485 | 473 | } |
| 486 | 474 | |
@@ -489,8 +477,7 @@ discard block |
||
| 489 | 477 | * @param string $ext |
| 490 | 478 | * @return string|false |
| 491 | 479 | */ |
| 492 | - private function findFileWithExtension($class, $ext) |
|
| 493 | - { |
|
| 480 | + private function findFileWithExtension($class, $ext) { |
|
| 494 | 481 | // PSR-4 lookup |
| 495 | 482 | $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
| 496 | 483 | |
@@ -523,7 +510,8 @@ discard block |
||
| 523 | 510 | // namespaced class name |
| 524 | 511 | $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) |
| 525 | 512 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
| 526 | - } else { |
|
| 513 | + } |
|
| 514 | + else { |
|
| 527 | 515 | // PEAR-like class name |
| 528 | 516 | $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
| 529 | 517 | } |
@@ -558,8 +546,7 @@ discard block |
||
| 558 | 546 | /** |
| 559 | 547 | * @return void |
| 560 | 548 | */ |
| 561 | - private static function initializeIncludeClosure() |
|
| 562 | - { |
|
| 549 | + private static function initializeIncludeClosure() { |
|
| 563 | 550 | if (self::$includeFile !== null) { |
| 564 | 551 | return; |
| 565 | 552 | } |
@@ -4,45 +4,45 @@ |
||
| 4 | 4 | |
| 5 | 5 | class ComposerAutoloaderInit153a56a781a72686b71399955d98204f |
| 6 | 6 | { |
| 7 | - private static $loader; |
|
| 8 | - |
|
| 9 | - public static function loadClassLoader($class) |
|
| 10 | - { |
|
| 11 | - if ('Composer\Autoload\ClassLoader' === $class) { |
|
| 12 | - require __DIR__ . '/ClassLoader.php'; |
|
| 13 | - } |
|
| 14 | - } |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * @return \Composer\Autoload\ClassLoader |
|
| 18 | - */ |
|
| 19 | - public static function getLoader() |
|
| 20 | - { |
|
| 21 | - if (null !== self::$loader) { |
|
| 22 | - return self::$loader; |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - spl_autoload_register(array('ComposerAutoloaderInit153a56a781a72686b71399955d98204f', 'loadClassLoader'), true, true); |
|
| 26 | - self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); |
|
| 27 | - spl_autoload_unregister(array('ComposerAutoloaderInit153a56a781a72686b71399955d98204f', 'loadClassLoader')); |
|
| 28 | - |
|
| 29 | - require __DIR__ . '/autoload_static.php'; |
|
| 30 | - call_user_func(\Composer\Autoload\ComposerStaticInit153a56a781a72686b71399955d98204f::getInitializer($loader)); |
|
| 31 | - |
|
| 32 | - $loader->register(true); |
|
| 33 | - |
|
| 34 | - $filesToLoad = \Composer\Autoload\ComposerStaticInit153a56a781a72686b71399955d98204f::$files; |
|
| 35 | - $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { |
|
| 36 | - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { |
|
| 37 | - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; |
|
| 38 | - |
|
| 39 | - require $file; |
|
| 40 | - } |
|
| 41 | - }, null, null); |
|
| 42 | - foreach ($filesToLoad as $fileIdentifier => $file) { |
|
| 43 | - $requireFile($fileIdentifier, $file); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - return $loader; |
|
| 47 | - } |
|
| 7 | + private static $loader; |
|
| 8 | + |
|
| 9 | + public static function loadClassLoader($class) |
|
| 10 | + { |
|
| 11 | + if ('Composer\Autoload\ClassLoader' === $class) { |
|
| 12 | + require __DIR__ . '/ClassLoader.php'; |
|
| 13 | + } |
|
| 14 | + } |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * @return \Composer\Autoload\ClassLoader |
|
| 18 | + */ |
|
| 19 | + public static function getLoader() |
|
| 20 | + { |
|
| 21 | + if (null !== self::$loader) { |
|
| 22 | + return self::$loader; |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + spl_autoload_register(array('ComposerAutoloaderInit153a56a781a72686b71399955d98204f', 'loadClassLoader'), true, true); |
|
| 26 | + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); |
|
| 27 | + spl_autoload_unregister(array('ComposerAutoloaderInit153a56a781a72686b71399955d98204f', 'loadClassLoader')); |
|
| 28 | + |
|
| 29 | + require __DIR__ . '/autoload_static.php'; |
|
| 30 | + call_user_func(\Composer\Autoload\ComposerStaticInit153a56a781a72686b71399955d98204f::getInitializer($loader)); |
|
| 31 | + |
|
| 32 | + $loader->register(true); |
|
| 33 | + |
|
| 34 | + $filesToLoad = \Composer\Autoload\ComposerStaticInit153a56a781a72686b71399955d98204f::$files; |
|
| 35 | + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { |
|
| 36 | + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { |
|
| 37 | + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; |
|
| 38 | + |
|
| 39 | + require $file; |
|
| 40 | + } |
|
| 41 | + }, null, null); |
|
| 42 | + foreach ($filesToLoad as $fileIdentifier => $file) { |
|
| 43 | + $requireFile($fileIdentifier, $file); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + return $loader; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -6,8 +6,7 @@ discard block |
||
| 6 | 6 | { |
| 7 | 7 | private static $loader; |
| 8 | 8 | |
| 9 | - public static function loadClassLoader($class) |
|
| 10 | - { |
|
| 9 | + public static function loadClassLoader($class) { |
|
| 11 | 10 | if ('Composer\Autoload\ClassLoader' === $class) { |
| 12 | 11 | require __DIR__ . '/ClassLoader.php'; |
| 13 | 12 | } |
@@ -16,8 +15,7 @@ discard block |
||
| 16 | 15 | /** |
| 17 | 16 | * @return \Composer\Autoload\ClassLoader |
| 18 | 17 | */ |
| 19 | - public static function getLoader() |
|
| 20 | - { |
|
| 18 | + public static function getLoader() { |
|
| 21 | 19 | if (null !== self::$loader) { |
| 22 | 20 | return self::$loader; |
| 23 | 21 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | 'MAPIProvider' => $baseDir . '/lib/grommunio/mapiprovider.php', |
| 53 | 53 | 'MAPIStreamWrapper' => $baseDir . '/lib/grommunio/mapistreamwrapper.php', |
| 54 | 54 | 'MAPIUtils' => $baseDir . '/lib/grommunio/mapiutils.php', |
| 55 | - 'Mail_RFC822' => $baseDir . '/lib/utils/g_RFC822.php', |
|
| 55 | + 'Mail_RFC822' => $baseDir . '/lib/utils/g_RFC822.php', |
|
| 56 | 56 | 'MeetingResponse' => $baseDir . '/lib/request/meetingresponse.php', |
| 57 | 57 | 'Meetingrequest' => '/usr/share/php-mapi/class.meetingrequest.php', |
| 58 | 58 | 'MoveItems' => $baseDir . '/lib/request/moveitems.php', |
@@ -3,18 +3,18 @@ |
||
| 3 | 3 | // autoload.php @generated by Composer |
| 4 | 4 | |
| 5 | 5 | if (PHP_VERSION_ID < 50600) { |
| 6 | - if (!headers_sent()) { |
|
| 7 | - header('HTTP/1.1 500 Internal Server Error'); |
|
| 8 | - } |
|
| 9 | - $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; |
|
| 10 | - if (!ini_get('display_errors')) { |
|
| 11 | - if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { |
|
| 12 | - fwrite(STDERR, $err); |
|
| 13 | - } elseif (!headers_sent()) { |
|
| 14 | - echo $err; |
|
| 15 | - } |
|
| 16 | - } |
|
| 17 | - throw new RuntimeException($err); |
|
| 6 | + if (!headers_sent()) { |
|
| 7 | + header('HTTP/1.1 500 Internal Server Error'); |
|
| 8 | + } |
|
| 9 | + $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; |
|
| 10 | + if (!ini_get('display_errors')) { |
|
| 11 | + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { |
|
| 12 | + fwrite(STDERR, $err); |
|
| 13 | + } elseif (!headers_sent()) { |
|
| 14 | + echo $err; |
|
| 15 | + } |
|
| 16 | + } |
|
| 17 | + throw new RuntimeException($err); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | require_once __DIR__ . '/composer/autoload_real.php'; |
@@ -10,7 +10,8 @@ |
||
| 10 | 10 | if (!ini_get('display_errors')) { |
| 11 | 11 | if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { |
| 12 | 12 | fwrite(STDERR, $err); |
| 13 | - } elseif (!headers_sent()) { |
|
| 13 | + } |
|
| 14 | + elseif (!headers_sent()) { |
|
| 14 | 15 | echo $err; |
| 15 | 16 | } |
| 16 | 17 | } |