Changeset 2684569
- Timestamp:
- 02/24/2022 07:35:40 PM (4 years ago)
- Location:
- jpd2
- Files:
-
- 36 added
- 2 deleted
- 16 edited
- 1 copied
-
tags/0.8.6 (copied) (copied from jpd2/trunk)
-
tags/0.8.6/assets (deleted)
-
tags/0.8.6/jpd2.php (modified) (1 diff)
-
tags/0.8.6/output (added)
-
tags/0.8.6/output/class-jpd2.php (added)
-
tags/0.8.6/output/jpd2.php (added)
-
tags/0.8.6/output/readme.txt (added)
-
tags/0.8.6/output/vendor (added)
-
tags/0.8.6/output/vendor/autoload.php (added)
-
tags/0.8.6/output/vendor/composer (added)
-
tags/0.8.6/output/vendor/composer/ClassLoader.php (added)
-
tags/0.8.6/output/vendor/composer/InstalledVersions.php (added)
-
tags/0.8.6/output/vendor/composer/LICENSE (added)
-
tags/0.8.6/output/vendor/composer/autoload_classmap.php (added)
-
tags/0.8.6/output/vendor/composer/autoload_namespaces.php (added)
-
tags/0.8.6/output/vendor/composer/autoload_psr4.php (added)
-
tags/0.8.6/output/vendor/composer/autoload_real.php (added)
-
tags/0.8.6/output/vendor/composer/autoload_static.php (added)
-
tags/0.8.6/output/vendor/composer/installed.json (added)
-
tags/0.8.6/output/vendor/composer/installed.php (added)
-
tags/0.8.6/pluginMachine.json (added)
-
tags/0.8.6/readme.txt (modified) (1 diff)
-
tags/0.8.6/vendor/autoload.php (modified) (1 diff)
-
tags/0.8.6/vendor/composer/ClassLoader.php (modified) (20 diffs)
-
tags/0.8.6/vendor/composer/InstalledVersions.php (modified) (2 diffs)
-
tags/0.8.6/vendor/composer/autoload_real.php (modified) (3 diffs)
-
tags/0.8.6/vendor/composer/autoload_static.php (modified) (2 diffs)
-
tags/0.8.6/vendor/composer/installed.php (modified) (1 diff)
-
trunk/assets (deleted)
-
trunk/jpd2.php (modified) (1 diff)
-
trunk/output (added)
-
trunk/output/class-jpd2.php (added)
-
trunk/output/jpd2.php (added)
-
trunk/output/readme.txt (added)
-
trunk/output/vendor (added)
-
trunk/output/vendor/autoload.php (added)
-
trunk/output/vendor/composer (added)
-
trunk/output/vendor/composer/ClassLoader.php (added)
-
trunk/output/vendor/composer/InstalledVersions.php (added)
-
trunk/output/vendor/composer/LICENSE (added)
-
trunk/output/vendor/composer/autoload_classmap.php (added)
-
trunk/output/vendor/composer/autoload_namespaces.php (added)
-
trunk/output/vendor/composer/autoload_psr4.php (added)
-
trunk/output/vendor/composer/autoload_real.php (added)
-
trunk/output/vendor/composer/autoload_static.php (added)
-
trunk/output/vendor/composer/installed.json (added)
-
trunk/output/vendor/composer/installed.php (added)
-
trunk/pluginMachine.json (added)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/ClassLoader.php (modified) (20 diffs)
-
trunk/vendor/composer/InstalledVersions.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_real.php (modified) (3 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
jpd2/tags/0.8.6/jpd2.php
r2684482 r2684569 4 4 Plugin URI: http://joshpress.net/blog/jpd2/ 5 5 Description: Makes caching WordPress queries via the Transients API easy. 6 Version: 0.8. 46 Version: 0.8.6 7 7 Author: Josh Pollock 8 8 Author URI: http://www.JoshPress.net -
jpd2/tags/0.8.6/readme.txt
r2684482 r2684569 6 6 Requires at least: 3.8 7 7 Tested up to: 3.8.1 8 Stable tag: 0.8. 48 Stable tag: 0.8.6 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
jpd2/tags/0.8.6/vendor/autoload.php
r2684482 r2684569 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit f6fc4f003c8af87f667d001c46ec3468::getLoader();7 return ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8::getLoader(); -
jpd2/tags/0.8.6/vendor/composer/ClassLoader.php
r2684481 r2684569 43 43 class ClassLoader 44 44 { 45 /** @var ?string */46 45 private $vendorDir; 47 46 48 47 // PSR-4 49 /**50 * @var array[]51 * @psalm-var array<string, array<string, int>>52 */53 48 private $prefixLengthsPsr4 = array(); 54 /**55 * @var array[]56 * @psalm-var array<string, array<int, string>>57 */58 49 private $prefixDirsPsr4 = array(); 59 /**60 * @var array[]61 * @psalm-var array<string, string>62 */63 50 private $fallbackDirsPsr4 = array(); 64 51 65 52 // PSR-0 66 /**67 * @var array[]68 * @psalm-var array<string, array<string, string[]>>69 */70 53 private $prefixesPsr0 = array(); 71 /**72 * @var array[]73 * @psalm-var array<string, string>74 */75 54 private $fallbackDirsPsr0 = array(); 76 55 77 /** @var bool */78 56 private $useIncludePath = false; 79 80 /**81 * @var string[]82 * @psalm-var array<string, string>83 */84 57 private $classMap = array(); 85 86 /** @var bool */87 58 private $classMapAuthoritative = false; 88 89 /**90 * @var bool[]91 * @psalm-var array<string, bool>92 */93 59 private $missingClasses = array(); 94 95 /** @var ?string */96 60 private $apcuPrefix; 97 61 98 /**99 * @var self[]100 */101 62 private static $registeredLoaders = array(); 102 63 103 /**104 * @param ?string $vendorDir105 */106 64 public function __construct($vendorDir = null) 107 65 { … … 109 67 } 110 68 111 /**112 * @return string[]113 */114 69 public function getPrefixes() 115 70 { … … 121 76 } 122 77 123 /**124 * @return array[]125 * @psalm-return array<string, array<int, string>>126 */127 78 public function getPrefixesPsr4() 128 79 { … … 130 81 } 131 82 132 /**133 * @return array[]134 * @psalm-return array<string, string>135 */136 83 public function getFallbackDirs() 137 84 { … … 139 86 } 140 87 141 /**142 * @return array[]143 * @psalm-return array<string, string>144 */145 88 public function getFallbackDirsPsr4() 146 89 { … … 148 91 } 149 92 150 /**151 * @return string[] Array of classname => path152 * @psalm-return array<string, string>153 */154 93 public function getClassMap() 155 94 { … … 158 97 159 98 /** 160 * @param string[] $classMap Class to filename map 161 * @psalm-param array<string, string> $classMap 162 * 163 * @return void 99 * @param array $classMap Class to filename map 164 100 */ 165 101 public function addClassMap(array $classMap) … … 176 112 * appending or prepending to the ones previously set for this prefix. 177 113 * 178 * @param string $prefix The prefix 179 * @param string[]|string $paths The PSR-0 root directories 180 * @param bool $prepend Whether to prepend the directories 181 * 182 * @return void 114 * @param string $prefix The prefix 115 * @param array|string $paths The PSR-0 root directories 116 * @param bool $prepend Whether to prepend the directories 183 117 */ 184 118 public function add($prefix, $paths, $prepend = false) … … 223 157 * appending or prepending to the ones previously set for this namespace. 224 158 * 225 * @param string $prefix The prefix/namespace, with trailing '\\'226 * @param string[]|string $paths The PSR-4 base directories227 * @param bool $prepend Whether to prepend the directories159 * @param string $prefix The prefix/namespace, with trailing '\\' 160 * @param array|string $paths The PSR-4 base directories 161 * @param bool $prepend Whether to prepend the directories 228 162 * 229 163 * @throws \InvalidArgumentException 230 *231 * @return void232 164 */ 233 165 public function addPsr4($prefix, $paths, $prepend = false) … … 273 205 * replacing any others previously set for this prefix. 274 206 * 275 * @param string $prefix The prefix 276 * @param string[]|string $paths The PSR-0 base directories 277 * 278 * @return void 207 * @param string $prefix The prefix 208 * @param array|string $paths The PSR-0 base directories 279 209 */ 280 210 public function set($prefix, $paths) … … 291 221 * replacing any others previously set for this namespace. 292 222 * 293 * @param string $prefix The prefix/namespace, with trailing '\\'294 * @param string[]|string $paths The PSR-4 base directories223 * @param string $prefix The prefix/namespace, with trailing '\\' 224 * @param array|string $paths The PSR-4 base directories 295 225 * 296 226 * @throws \InvalidArgumentException 297 *298 * @return void299 227 */ 300 228 public function setPsr4($prefix, $paths) … … 316 244 * 317 245 * @param bool $useIncludePath 318 *319 * @return void320 246 */ 321 247 public function setUseIncludePath($useIncludePath) … … 340 266 * 341 267 * @param bool $classMapAuthoritative 342 *343 * @return void344 268 */ 345 269 public function setClassMapAuthoritative($classMapAuthoritative) … … 362 286 * 363 287 * @param string|null $apcuPrefix 364 *365 * @return void366 288 */ 367 289 public function setApcuPrefix($apcuPrefix) … … 384 306 * 385 307 * @param bool $prepend Whether to prepend the autoloader or not 386 *387 * @return void388 308 */ 389 309 public function register($prepend = false) … … 405 325 /** 406 326 * Unregisters this instance as an autoloader. 407 *408 * @return void409 327 */ 410 328 public function unregister() … … 421 339 * 422 340 * @param string $class The name of the class 423 * @return true|null True if loaded, null otherwise341 * @return bool|null True if loaded, null otherwise 424 342 */ 425 343 public function loadClass($class) … … 430 348 return true; 431 349 } 432 433 return null;434 350 } 435 351 … … 486 402 } 487 403 488 /**489 * @param string $class490 * @param string $ext491 * @return string|false492 */493 404 private function findFileWithExtension($class, $ext) 494 405 { … … 562 473 * 563 474 * Prevents access to $this/self from included files. 564 *565 * @param string $file566 * @return void567 * @private568 475 */ 569 476 function includeFile($file) -
jpd2/tags/0.8.6/vendor/composer/InstalledVersions.php
r2684481 r2684569 1 1 <?php 2 2 3 /* 4 * This file is part of Composer. 5 * 6 * (c) Nils Adermann <[email protected]> 7 * Jordi Boggiano <[email protected]> 8 * 9 * For the full copyright and license information, please view the LICENSE 10 * file that was distributed with this source code. 11 */ 3 4 5 6 7 8 9 10 11 12 12 13 13 namespace Composer; … … 16 16 use Composer\Semver\VersionParser; 17 17 18 /** 19 * This class is copied in every Composer installed project and available to all 20 * 21 * See also https://getcomposer.org/doc/07-runtime.md#installed-versions 22 * 23 * To require its presence, you can require `composer-runtime-api ^2.0` 24 */ 18 19 20 21 22 23 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 } 350 } 27 private static $installed = array ( 28 'root' => 29 array ( 30 'pretty_version' => '0.8.6', 31 'version' => '0.8.6.0', 32 'aliases' => 33 array ( 34 ), 35 'reference' => '565e35df321e8d028ca79117e3e782d94b0d2062', 36 'name' => '__root__', 37 ), 38 'versions' => 39 array ( 40 '__root__' => 41 array ( 42 'pretty_version' => '0.8.6', 43 'version' => '0.8.6.0', 44 'aliases' => 45 array ( 46 ), 47 'reference' => '565e35df321e8d028ca79117e3e782d94b0d2062', 48 ), 49 ), 50 ); 51 private static $canGetVendors; 52 private static $installedByVendor = array(); 53 54 55 56 57 58 59 60 public static function getInstalledPackages() 61 { 62 $packages = array(); 63 foreach (self::getInstalled() as $installed) { 64 $packages[] = array_keys($installed['versions']); 65 } 66 67 if (1 === \count($packages)) { 68 return $packages[0]; 69 } 70 71 return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); 72 } 73 74 75 76 77 78 79 80 81 82 public static function isInstalled($packageName) 83 { 84 foreach (self::getInstalled() as $installed) { 85 if (isset($installed['versions'][$packageName])) { 86 return true; 87 } 88 } 89 90 return false; 91 } 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 public static function satisfies(VersionParser $parser, $packageName, $constraint) 107 { 108 $constraint = $parser->parseConstraints($constraint); 109 $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); 110 111 return $provided->matches($constraint); 112 } 113 114 115 116 117 118 119 120 121 122 123 public static function getVersionRanges($packageName) 124 { 125 foreach (self::getInstalled() as $installed) { 126 if (!isset($installed['versions'][$packageName])) { 127 continue; 128 } 129 130 $ranges = array(); 131 if (isset($installed['versions'][$packageName]['pretty_version'])) { 132 $ranges[] = $installed['versions'][$packageName]['pretty_version']; 133 } 134 if (array_key_exists('aliases', $installed['versions'][$packageName])) { 135 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); 136 } 137 if (array_key_exists('replaced', $installed['versions'][$packageName])) { 138 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); 139 } 140 if (array_key_exists('provided', $installed['versions'][$packageName])) { 141 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); 142 } 143 144 return implode(' || ', $ranges); 145 } 146 147 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 148 } 149 150 151 152 153 154 public static function getVersion($packageName) 155 { 156 foreach (self::getInstalled() as $installed) { 157 if (!isset($installed['versions'][$packageName])) { 158 continue; 159 } 160 161 if (!isset($installed['versions'][$packageName]['version'])) { 162 return null; 163 } 164 165 return $installed['versions'][$packageName]['version']; 166 } 167 168 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 169 } 170 171 172 173 174 175 public static function getPrettyVersion($packageName) 176 { 177 foreach (self::getInstalled() as $installed) { 178 if (!isset($installed['versions'][$packageName])) { 179 continue; 180 } 181 182 if (!isset($installed['versions'][$packageName]['pretty_version'])) { 183 return null; 184 } 185 186 return $installed['versions'][$packageName]['pretty_version']; 187 } 188 189 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 190 } 191 192 193 194 195 196 public static function getReference($packageName) 197 { 198 foreach (self::getInstalled() as $installed) { 199 if (!isset($installed['versions'][$packageName])) { 200 continue; 201 } 202 203 if (!isset($installed['versions'][$packageName]['reference'])) { 204 return null; 205 } 206 207 return $installed['versions'][$packageName]['reference']; 208 } 209 210 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 211 } 212 213 214 215 216 217 public static function getRootPackage() 218 { 219 $installed = self::getInstalled(); 220 221 return $installed[0]['root']; 222 } 223 224 225 226 227 228 229 230 231 public static function getRawData() 232 { 233 @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); 234 235 return self::$installed; 236 } 237 238 239 240 241 242 243 244 public static function getAllRawData() 245 { 246 return self::getInstalled(); 247 } 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 public static function reload($data) 268 { 269 self::$installed = $data; 270 self::$installedByVendor = array(); 271 } 272 273 274 275 276 277 private static function getInstalled() 278 { 279 if (null === self::$canGetVendors) { 280 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); 281 } 282 283 $installed = array(); 284 285 if (self::$canGetVendors) { 286 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 287 if (isset(self::$installedByVendor[$vendorDir])) { 288 $installed[] = self::$installedByVendor[$vendorDir]; 289 } elseif (is_file($vendorDir.'/composer/installed.php')) { 290 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; 291 } 292 } 293 } 294 295 $installed[] = self::$installed; 296 297 return $installed; 298 } 299 } -
jpd2/tags/0.8.6/vendor/composer/autoload_real.php
r2684482 r2684569 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit f6fc4f003c8af87f667d001c46ec34685 class ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit f6fc4f003c8af87f667d001c46ec3468', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 27 spl_autoload_unregister(array('ComposerAutoloaderInit f6fc4f003c8af87f667d001c46ec3468', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8', 'loadClassLoader')); 28 28 29 29 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 31 31 require __DIR__ . '/autoload_static.php'; 32 32 33 call_user_func(\Composer\Autoload\ComposerStaticInit f6fc4f003c8af87f667d001c46ec3468::getInitializer($loader));33 call_user_func(\Composer\Autoload\ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::getInitializer($loader)); 34 34 } else { 35 35 $map = require __DIR__ . '/autoload_namespaces.php'; -
jpd2/tags/0.8.6/vendor/composer/autoload_static.php
r2684482 r2684569 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit f6fc4f003c8af87f667d001c46ec34687 class ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 28 28 { 29 29 return \Closure::bind(function () use ($loader) { 30 $loader->prefixLengthsPsr4 = ComposerStaticInit f6fc4f003c8af87f667d001c46ec3468::$prefixLengthsPsr4;31 $loader->prefixDirsPsr4 = ComposerStaticInit f6fc4f003c8af87f667d001c46ec3468::$prefixDirsPsr4;32 $loader->classMap = ComposerStaticInit f6fc4f003c8af87f667d001c46ec3468::$classMap;30 $loader->prefixLengthsPsr4 = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$prefixLengthsPsr4; 31 $loader->prefixDirsPsr4 = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$prefixDirsPsr4; 32 $loader->classMap = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$classMap; 33 33 34 34 }, null, ClassLoader::class); -
jpd2/tags/0.8.6/vendor/composer/installed.php
r2684482 r2684569 1 <?php return array( 2 'root' => array( 3 'pretty_version' => '0.8.4', 4 'version' => '0.8.4.0', 5 'type' => 'wordpress-plugin', 6 'install_path' => __DIR__ . '/../../', 7 'aliases' => array(), 8 'reference' => '4f7dd4492f1fe8642d73c7bf9749934b80b78d0a', 9 'name' => '__root__', 10 'dev' => false, 1 <?php return array ( 2 'root' => 3 array ( 4 'pretty_version' => '0.8.6', 5 'version' => '0.8.6.0', 6 'aliases' => 7 array ( 11 8 ), 12 'versions' => array( 13 '__root__' => array( 14 'pretty_version' => '0.8.4', 15 'version' => '0.8.4.0', 16 'type' => 'wordpress-plugin', 17 'install_path' => __DIR__ . '/../../', 18 'aliases' => array(), 19 'reference' => '4f7dd4492f1fe8642d73c7bf9749934b80b78d0a', 20 'dev_requirement' => false, 21 ), 9 'reference' => '565e35df321e8d028ca79117e3e782d94b0d2062', 10 'name' => '__root__', 11 ), 12 'versions' => 13 array ( 14 '__root__' => 15 array ( 16 'pretty_version' => '0.8.6', 17 'version' => '0.8.6.0', 18 'aliases' => 19 array ( 20 ), 21 'reference' => '565e35df321e8d028ca79117e3e782d94b0d2062', 22 22 ), 23 ), 23 24 ); -
jpd2/trunk/jpd2.php
r2684482 r2684569 4 4 Plugin URI: http://joshpress.net/blog/jpd2/ 5 5 Description: Makes caching WordPress queries via the Transients API easy. 6 Version: 0.8. 46 Version: 0.8.6 7 7 Author: Josh Pollock 8 8 Author URI: http://www.JoshPress.net -
jpd2/trunk/readme.txt
r2684482 r2684569 6 6 Requires at least: 3.8 7 7 Tested up to: 3.8.1 8 Stable tag: 0.8. 48 Stable tag: 0.8.6 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
jpd2/trunk/vendor/autoload.php
r2684482 r2684569 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit f6fc4f003c8af87f667d001c46ec3468::getLoader();7 return ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8::getLoader(); -
jpd2/trunk/vendor/composer/ClassLoader.php
r2684481 r2684569 43 43 class ClassLoader 44 44 { 45 /** @var ?string */46 45 private $vendorDir; 47 46 48 47 // PSR-4 49 /**50 * @var array[]51 * @psalm-var array<string, array<string, int>>52 */53 48 private $prefixLengthsPsr4 = array(); 54 /**55 * @var array[]56 * @psalm-var array<string, array<int, string>>57 */58 49 private $prefixDirsPsr4 = array(); 59 /**60 * @var array[]61 * @psalm-var array<string, string>62 */63 50 private $fallbackDirsPsr4 = array(); 64 51 65 52 // PSR-0 66 /**67 * @var array[]68 * @psalm-var array<string, array<string, string[]>>69 */70 53 private $prefixesPsr0 = array(); 71 /**72 * @var array[]73 * @psalm-var array<string, string>74 */75 54 private $fallbackDirsPsr0 = array(); 76 55 77 /** @var bool */78 56 private $useIncludePath = false; 79 80 /**81 * @var string[]82 * @psalm-var array<string, string>83 */84 57 private $classMap = array(); 85 86 /** @var bool */87 58 private $classMapAuthoritative = false; 88 89 /**90 * @var bool[]91 * @psalm-var array<string, bool>92 */93 59 private $missingClasses = array(); 94 95 /** @var ?string */96 60 private $apcuPrefix; 97 61 98 /**99 * @var self[]100 */101 62 private static $registeredLoaders = array(); 102 63 103 /**104 * @param ?string $vendorDir105 */106 64 public function __construct($vendorDir = null) 107 65 { … … 109 67 } 110 68 111 /**112 * @return string[]113 */114 69 public function getPrefixes() 115 70 { … … 121 76 } 122 77 123 /**124 * @return array[]125 * @psalm-return array<string, array<int, string>>126 */127 78 public function getPrefixesPsr4() 128 79 { … … 130 81 } 131 82 132 /**133 * @return array[]134 * @psalm-return array<string, string>135 */136 83 public function getFallbackDirs() 137 84 { … … 139 86 } 140 87 141 /**142 * @return array[]143 * @psalm-return array<string, string>144 */145 88 public function getFallbackDirsPsr4() 146 89 { … … 148 91 } 149 92 150 /**151 * @return string[] Array of classname => path152 * @psalm-return array<string, string>153 */154 93 public function getClassMap() 155 94 { … … 158 97 159 98 /** 160 * @param string[] $classMap Class to filename map 161 * @psalm-param array<string, string> $classMap 162 * 163 * @return void 99 * @param array $classMap Class to filename map 164 100 */ 165 101 public function addClassMap(array $classMap) … … 176 112 * appending or prepending to the ones previously set for this prefix. 177 113 * 178 * @param string $prefix The prefix 179 * @param string[]|string $paths The PSR-0 root directories 180 * @param bool $prepend Whether to prepend the directories 181 * 182 * @return void 114 * @param string $prefix The prefix 115 * @param array|string $paths The PSR-0 root directories 116 * @param bool $prepend Whether to prepend the directories 183 117 */ 184 118 public function add($prefix, $paths, $prepend = false) … … 223 157 * appending or prepending to the ones previously set for this namespace. 224 158 * 225 * @param string $prefix The prefix/namespace, with trailing '\\'226 * @param string[]|string $paths The PSR-4 base directories227 * @param bool $prepend Whether to prepend the directories159 * @param string $prefix The prefix/namespace, with trailing '\\' 160 * @param array|string $paths The PSR-4 base directories 161 * @param bool $prepend Whether to prepend the directories 228 162 * 229 163 * @throws \InvalidArgumentException 230 *231 * @return void232 164 */ 233 165 public function addPsr4($prefix, $paths, $prepend = false) … … 273 205 * replacing any others previously set for this prefix. 274 206 * 275 * @param string $prefix The prefix 276 * @param string[]|string $paths The PSR-0 base directories 277 * 278 * @return void 207 * @param string $prefix The prefix 208 * @param array|string $paths The PSR-0 base directories 279 209 */ 280 210 public function set($prefix, $paths) … … 291 221 * replacing any others previously set for this namespace. 292 222 * 293 * @param string $prefix The prefix/namespace, with trailing '\\'294 * @param string[]|string $paths The PSR-4 base directories223 * @param string $prefix The prefix/namespace, with trailing '\\' 224 * @param array|string $paths The PSR-4 base directories 295 225 * 296 226 * @throws \InvalidArgumentException 297 *298 * @return void299 227 */ 300 228 public function setPsr4($prefix, $paths) … … 316 244 * 317 245 * @param bool $useIncludePath 318 *319 * @return void320 246 */ 321 247 public function setUseIncludePath($useIncludePath) … … 340 266 * 341 267 * @param bool $classMapAuthoritative 342 *343 * @return void344 268 */ 345 269 public function setClassMapAuthoritative($classMapAuthoritative) … … 362 286 * 363 287 * @param string|null $apcuPrefix 364 *365 * @return void366 288 */ 367 289 public function setApcuPrefix($apcuPrefix) … … 384 306 * 385 307 * @param bool $prepend Whether to prepend the autoloader or not 386 *387 * @return void388 308 */ 389 309 public function register($prepend = false) … … 405 325 /** 406 326 * Unregisters this instance as an autoloader. 407 *408 * @return void409 327 */ 410 328 public function unregister() … … 421 339 * 422 340 * @param string $class The name of the class 423 * @return true|null True if loaded, null otherwise341 * @return bool|null True if loaded, null otherwise 424 342 */ 425 343 public function loadClass($class) … … 430 348 return true; 431 349 } 432 433 return null;434 350 } 435 351 … … 486 402 } 487 403 488 /**489 * @param string $class490 * @param string $ext491 * @return string|false492 */493 404 private function findFileWithExtension($class, $ext) 494 405 { … … 562 473 * 563 474 * Prevents access to $this/self from included files. 564 *565 * @param string $file566 * @return void567 * @private568 475 */ 569 476 function includeFile($file) -
jpd2/trunk/vendor/composer/InstalledVersions.php
r2684481 r2684569 1 1 <?php 2 2 3 /* 4 * This file is part of Composer. 5 * 6 * (c) Nils Adermann <[email protected]> 7 * Jordi Boggiano <[email protected]> 8 * 9 * For the full copyright and license information, please view the LICENSE 10 * file that was distributed with this source code. 11 */ 3 4 5 6 7 8 9 10 11 12 12 13 13 namespace Composer; … … 16 16 use Composer\Semver\VersionParser; 17 17 18 /** 19 * This class is copied in every Composer installed project and available to all 20 * 21 * See also https://getcomposer.org/doc/07-runtime.md#installed-versions 22 * 23 * To require its presence, you can require `composer-runtime-api ^2.0` 24 */ 18 19 20 21 22 23 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 } 350 } 27 private static $installed = array ( 28 'root' => 29 array ( 30 'pretty_version' => '0.8.6', 31 'version' => '0.8.6.0', 32 'aliases' => 33 array ( 34 ), 35 'reference' => '565e35df321e8d028ca79117e3e782d94b0d2062', 36 'name' => '__root__', 37 ), 38 'versions' => 39 array ( 40 '__root__' => 41 array ( 42 'pretty_version' => '0.8.6', 43 'version' => '0.8.6.0', 44 'aliases' => 45 array ( 46 ), 47 'reference' => '565e35df321e8d028ca79117e3e782d94b0d2062', 48 ), 49 ), 50 ); 51 private static $canGetVendors; 52 private static $installedByVendor = array(); 53 54 55 56 57 58 59 60 public static function getInstalledPackages() 61 { 62 $packages = array(); 63 foreach (self::getInstalled() as $installed) { 64 $packages[] = array_keys($installed['versions']); 65 } 66 67 if (1 === \count($packages)) { 68 return $packages[0]; 69 } 70 71 return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); 72 } 73 74 75 76 77 78 79 80 81 82 public static function isInstalled($packageName) 83 { 84 foreach (self::getInstalled() as $installed) { 85 if (isset($installed['versions'][$packageName])) { 86 return true; 87 } 88 } 89 90 return false; 91 } 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 public static function satisfies(VersionParser $parser, $packageName, $constraint) 107 { 108 $constraint = $parser->parseConstraints($constraint); 109 $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); 110 111 return $provided->matches($constraint); 112 } 113 114 115 116 117 118 119 120 121 122 123 public static function getVersionRanges($packageName) 124 { 125 foreach (self::getInstalled() as $installed) { 126 if (!isset($installed['versions'][$packageName])) { 127 continue; 128 } 129 130 $ranges = array(); 131 if (isset($installed['versions'][$packageName]['pretty_version'])) { 132 $ranges[] = $installed['versions'][$packageName]['pretty_version']; 133 } 134 if (array_key_exists('aliases', $installed['versions'][$packageName])) { 135 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); 136 } 137 if (array_key_exists('replaced', $installed['versions'][$packageName])) { 138 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); 139 } 140 if (array_key_exists('provided', $installed['versions'][$packageName])) { 141 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); 142 } 143 144 return implode(' || ', $ranges); 145 } 146 147 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 148 } 149 150 151 152 153 154 public static function getVersion($packageName) 155 { 156 foreach (self::getInstalled() as $installed) { 157 if (!isset($installed['versions'][$packageName])) { 158 continue; 159 } 160 161 if (!isset($installed['versions'][$packageName]['version'])) { 162 return null; 163 } 164 165 return $installed['versions'][$packageName]['version']; 166 } 167 168 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 169 } 170 171 172 173 174 175 public static function getPrettyVersion($packageName) 176 { 177 foreach (self::getInstalled() as $installed) { 178 if (!isset($installed['versions'][$packageName])) { 179 continue; 180 } 181 182 if (!isset($installed['versions'][$packageName]['pretty_version'])) { 183 return null; 184 } 185 186 return $installed['versions'][$packageName]['pretty_version']; 187 } 188 189 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 190 } 191 192 193 194 195 196 public static function getReference($packageName) 197 { 198 foreach (self::getInstalled() as $installed) { 199 if (!isset($installed['versions'][$packageName])) { 200 continue; 201 } 202 203 if (!isset($installed['versions'][$packageName]['reference'])) { 204 return null; 205 } 206 207 return $installed['versions'][$packageName]['reference']; 208 } 209 210 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 211 } 212 213 214 215 216 217 public static function getRootPackage() 218 { 219 $installed = self::getInstalled(); 220 221 return $installed[0]['root']; 222 } 223 224 225 226 227 228 229 230 231 public static function getRawData() 232 { 233 @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); 234 235 return self::$installed; 236 } 237 238 239 240 241 242 243 244 public static function getAllRawData() 245 { 246 return self::getInstalled(); 247 } 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 public static function reload($data) 268 { 269 self::$installed = $data; 270 self::$installedByVendor = array(); 271 } 272 273 274 275 276 277 private static function getInstalled() 278 { 279 if (null === self::$canGetVendors) { 280 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); 281 } 282 283 $installed = array(); 284 285 if (self::$canGetVendors) { 286 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 287 if (isset(self::$installedByVendor[$vendorDir])) { 288 $installed[] = self::$installedByVendor[$vendorDir]; 289 } elseif (is_file($vendorDir.'/composer/installed.php')) { 290 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; 291 } 292 } 293 } 294 295 $installed[] = self::$installed; 296 297 return $installed; 298 } 299 } -
jpd2/trunk/vendor/composer/autoload_real.php
r2684482 r2684569 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit f6fc4f003c8af87f667d001c46ec34685 class ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit f6fc4f003c8af87f667d001c46ec3468', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 27 spl_autoload_unregister(array('ComposerAutoloaderInit f6fc4f003c8af87f667d001c46ec3468', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8', 'loadClassLoader')); 28 28 29 29 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 31 31 require __DIR__ . '/autoload_static.php'; 32 32 33 call_user_func(\Composer\Autoload\ComposerStaticInit f6fc4f003c8af87f667d001c46ec3468::getInitializer($loader));33 call_user_func(\Composer\Autoload\ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::getInitializer($loader)); 34 34 } else { 35 35 $map = require __DIR__ . '/autoload_namespaces.php'; -
jpd2/trunk/vendor/composer/autoload_static.php
r2684482 r2684569 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit f6fc4f003c8af87f667d001c46ec34687 class ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 28 28 { 29 29 return \Closure::bind(function () use ($loader) { 30 $loader->prefixLengthsPsr4 = ComposerStaticInit f6fc4f003c8af87f667d001c46ec3468::$prefixLengthsPsr4;31 $loader->prefixDirsPsr4 = ComposerStaticInit f6fc4f003c8af87f667d001c46ec3468::$prefixDirsPsr4;32 $loader->classMap = ComposerStaticInit f6fc4f003c8af87f667d001c46ec3468::$classMap;30 $loader->prefixLengthsPsr4 = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$prefixLengthsPsr4; 31 $loader->prefixDirsPsr4 = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$prefixDirsPsr4; 32 $loader->classMap = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$classMap; 33 33 34 34 }, null, ClassLoader::class); -
jpd2/trunk/vendor/composer/installed.php
r2684482 r2684569 1 <?php return array( 2 'root' => array( 3 'pretty_version' => '0.8.4', 4 'version' => '0.8.4.0', 5 'type' => 'wordpress-plugin', 6 'install_path' => __DIR__ . '/../../', 7 'aliases' => array(), 8 'reference' => '4f7dd4492f1fe8642d73c7bf9749934b80b78d0a', 9 'name' => '__root__', 10 'dev' => false, 1 <?php return array ( 2 'root' => 3 array ( 4 'pretty_version' => '0.8.6', 5 'version' => '0.8.6.0', 6 'aliases' => 7 array ( 11 8 ), 12 'versions' => array( 13 '__root__' => array( 14 'pretty_version' => '0.8.4', 15 'version' => '0.8.4.0', 16 'type' => 'wordpress-plugin', 17 'install_path' => __DIR__ . '/../../', 18 'aliases' => array(), 19 'reference' => '4f7dd4492f1fe8642d73c7bf9749934b80b78d0a', 20 'dev_requirement' => false, 21 ), 9 'reference' => '565e35df321e8d028ca79117e3e782d94b0d2062', 10 'name' => '__root__', 11 ), 12 'versions' => 13 array ( 14 '__root__' => 15 array ( 16 'pretty_version' => '0.8.6', 17 'version' => '0.8.6.0', 18 'aliases' => 19 array ( 20 ), 21 'reference' => '565e35df321e8d028ca79117e3e782d94b0d2062', 22 22 ), 23 ), 23 24 );
Note: See TracChangeset
for help on using the changeset viewer.