Plugin Directory

Changeset 2684569


Ignore:
Timestamp:
02/24/2022 07:35:40 PM (4 years ago)
Author:
Shelob9
Message:

Update to version 0.8.6 from GitHub

Location:
jpd2
Files:
36 added
2 deleted
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • jpd2/tags/0.8.6/jpd2.php

    r2684482 r2684569  
    44Plugin URI: http://joshpress.net/blog/jpd2/
    55Description: Makes caching WordPress queries via the Transients API easy.
    6 Version: 0.8.4
     6Version: 0.8.6
    77Author: Josh Pollock
    88Author URI: http://www.JoshPress.net
  • jpd2/tags/0.8.6/readme.txt

    r2684482 r2684569  
    66Requires at least: 3.8
    77Tested up to: 3.8.1
    8 Stable tag: 0.8.4
     8Stable tag: 0.8.6
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • jpd2/tags/0.8.6/vendor/autoload.php

    r2684482 r2684569  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitf6fc4f003c8af87f667d001c46ec3468::getLoader();
     7return ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8::getLoader();
  • jpd2/tags/0.8.6/vendor/composer/ClassLoader.php

    r2684481 r2684569  
    4343class ClassLoader
    4444{
    45     /** @var ?string */
    4645    private $vendorDir;
    4746
    4847    // PSR-4
    49     /**
    50      * @var array[]
    51      * @psalm-var array<string, array<string, int>>
    52      */
    5348    private $prefixLengthsPsr4 = array();
    54     /**
    55      * @var array[]
    56      * @psalm-var array<string, array<int, string>>
    57      */
    5849    private $prefixDirsPsr4 = array();
    59     /**
    60      * @var array[]
    61      * @psalm-var array<string, string>
    62      */
    6350    private $fallbackDirsPsr4 = array();
    6451
    6552    // PSR-0
    66     /**
    67      * @var array[]
    68      * @psalm-var array<string, array<string, string[]>>
    69      */
    7053    private $prefixesPsr0 = array();
    71     /**
    72      * @var array[]
    73      * @psalm-var array<string, string>
    74      */
    7554    private $fallbackDirsPsr0 = array();
    7655
    77     /** @var bool */
    7856    private $useIncludePath = false;
    79 
    80     /**
    81      * @var string[]
    82      * @psalm-var array<string, string>
    83      */
    8457    private $classMap = array();
    85 
    86     /** @var bool */
    8758    private $classMapAuthoritative = false;
    88 
    89     /**
    90      * @var bool[]
    91      * @psalm-var array<string, bool>
    92      */
    9359    private $missingClasses = array();
    94 
    95     /** @var ?string */
    9660    private $apcuPrefix;
    9761
    98     /**
    99      * @var self[]
    100      */
    10162    private static $registeredLoaders = array();
    10263
    103     /**
    104      * @param ?string $vendorDir
    105      */
    10664    public function __construct($vendorDir = null)
    10765    {
     
    10967    }
    11068
    111     /**
    112      * @return string[]
    113      */
    11469    public function getPrefixes()
    11570    {
     
    12176    }
    12277
    123     /**
    124      * @return array[]
    125      * @psalm-return array<string, array<int, string>>
    126      */
    12778    public function getPrefixesPsr4()
    12879    {
     
    13081    }
    13182
    132     /**
    133      * @return array[]
    134      * @psalm-return array<string, string>
    135      */
    13683    public function getFallbackDirs()
    13784    {
     
    13986    }
    14087
    141     /**
    142      * @return array[]
    143      * @psalm-return array<string, string>
    144      */
    14588    public function getFallbackDirsPsr4()
    14689    {
     
    14891    }
    14992
    150     /**
    151      * @return string[] Array of classname => path
    152      * @psalm-return array<string, string>
    153      */
    15493    public function getClassMap()
    15594    {
     
    15897
    15998    /**
    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
    164100     */
    165101    public function addClassMap(array $classMap)
     
    176112     * appending or prepending to the ones previously set for this prefix.
    177113     *
    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
    183117     */
    184118    public function add($prefix, $paths, $prepend = false)
     
    223157     * appending or prepending to the ones previously set for this namespace.
    224158     *
    225      * @param string          $prefix  The prefix/namespace, with trailing '\\'
    226      * @param string[]|string $paths   The PSR-4 base directories
    227      * @param bool            $prepend Whether to prepend the directories
     159     * @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
    228162     *
    229163     * @throws \InvalidArgumentException
    230      *
    231      * @return void
    232164     */
    233165    public function addPsr4($prefix, $paths, $prepend = false)
     
    273205     * replacing any others previously set for this prefix.
    274206     *
    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
    279209     */
    280210    public function set($prefix, $paths)
     
    291221     * replacing any others previously set for this namespace.
    292222     *
    293      * @param string          $prefix The prefix/namespace, with trailing '\\'
    294      * @param string[]|string $paths  The PSR-4 base directories
     223     * @param string       $prefix The prefix/namespace, with trailing '\\'
     224     * @param array|string $paths  The PSR-4 base directories
    295225     *
    296226     * @throws \InvalidArgumentException
    297      *
    298      * @return void
    299227     */
    300228    public function setPsr4($prefix, $paths)
     
    316244     *
    317245     * @param bool $useIncludePath
    318      *
    319      * @return void
    320246     */
    321247    public function setUseIncludePath($useIncludePath)
     
    340266     *
    341267     * @param bool $classMapAuthoritative
    342      *
    343      * @return void
    344268     */
    345269    public function setClassMapAuthoritative($classMapAuthoritative)
     
    362286     *
    363287     * @param string|null $apcuPrefix
    364      *
    365      * @return void
    366288     */
    367289    public function setApcuPrefix($apcuPrefix)
     
    384306     *
    385307     * @param bool $prepend Whether to prepend the autoloader or not
    386      *
    387      * @return void
    388308     */
    389309    public function register($prepend = false)
     
    405325    /**
    406326     * Unregisters this instance as an autoloader.
    407      *
    408      * @return void
    409327     */
    410328    public function unregister()
     
    421339     *
    422340     * @param  string    $class The name of the class
    423      * @return true|null True if loaded, null otherwise
     341     * @return bool|null True if loaded, null otherwise
    424342     */
    425343    public function loadClass($class)
     
    430348            return true;
    431349        }
    432 
    433         return null;
    434350    }
    435351
     
    486402    }
    487403
    488     /**
    489      * @param  string       $class
    490      * @param  string       $ext
    491      * @return string|false
    492      */
    493404    private function findFileWithExtension($class, $ext)
    494405    {
     
    562473 *
    563474 * Prevents access to $this/self from included files.
    564  *
    565  * @param  string $file
    566  * @return void
    567  * @private
    568475 */
    569476function includeFile($file)
  • jpd2/tags/0.8.6/vendor/composer/InstalledVersions.php

    r2684481 r2684569  
    11<?php
    22
    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
    1212
    1313namespace Composer;
     
    1616use Composer\Semver\VersionParser;
    1717
    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
    2525class InstalledVersions
    2626{
    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 }
     27private 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);
     51private static $canGetVendors;
     52private static $installedByVendor = array();
     53
     54
     55
     56
     57
     58
     59
     60public static function getInstalledPackages()
     61{
     62$packages = array();
     63foreach (self::getInstalled() as $installed) {
     64$packages[] = array_keys($installed['versions']);
     65}
     66
     67if (1 === \count($packages)) {
     68return $packages[0];
     69}
     70
     71return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
     72}
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82public static function isInstalled($packageName)
     83{
     84foreach (self::getInstalled() as $installed) {
     85if (isset($installed['versions'][$packageName])) {
     86return true;
     87}
     88}
     89
     90return false;
     91}
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106public static function satisfies(VersionParser $parser, $packageName, $constraint)
     107{
     108$constraint = $parser->parseConstraints($constraint);
     109$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
     110
     111return $provided->matches($constraint);
     112}
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123public static function getVersionRanges($packageName)
     124{
     125foreach (self::getInstalled() as $installed) {
     126if (!isset($installed['versions'][$packageName])) {
     127continue;
     128}
     129
     130$ranges = array();
     131if (isset($installed['versions'][$packageName]['pretty_version'])) {
     132$ranges[] = $installed['versions'][$packageName]['pretty_version'];
     133}
     134if (array_key_exists('aliases', $installed['versions'][$packageName])) {
     135$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
     136}
     137if (array_key_exists('replaced', $installed['versions'][$packageName])) {
     138$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
     139}
     140if (array_key_exists('provided', $installed['versions'][$packageName])) {
     141$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
     142}
     143
     144return implode(' || ', $ranges);
     145}
     146
     147throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     148}
     149
     150
     151
     152
     153
     154public static function getVersion($packageName)
     155{
     156foreach (self::getInstalled() as $installed) {
     157if (!isset($installed['versions'][$packageName])) {
     158continue;
     159}
     160
     161if (!isset($installed['versions'][$packageName]['version'])) {
     162return null;
     163}
     164
     165return $installed['versions'][$packageName]['version'];
     166}
     167
     168throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     169}
     170
     171
     172
     173
     174
     175public static function getPrettyVersion($packageName)
     176{
     177foreach (self::getInstalled() as $installed) {
     178if (!isset($installed['versions'][$packageName])) {
     179continue;
     180}
     181
     182if (!isset($installed['versions'][$packageName]['pretty_version'])) {
     183return null;
     184}
     185
     186return $installed['versions'][$packageName]['pretty_version'];
     187}
     188
     189throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     190}
     191
     192
     193
     194
     195
     196public static function getReference($packageName)
     197{
     198foreach (self::getInstalled() as $installed) {
     199if (!isset($installed['versions'][$packageName])) {
     200continue;
     201}
     202
     203if (!isset($installed['versions'][$packageName]['reference'])) {
     204return null;
     205}
     206
     207return $installed['versions'][$packageName]['reference'];
     208}
     209
     210throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     211}
     212
     213
     214
     215
     216
     217public static function getRootPackage()
     218{
     219$installed = self::getInstalled();
     220
     221return $installed[0]['root'];
     222}
     223
     224
     225
     226
     227
     228
     229
     230
     231public 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
     235return self::$installed;
     236}
     237
     238
     239
     240
     241
     242
     243
     244public static function getAllRawData()
     245{
     246return self::getInstalled();
     247}
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
     263
     264
     265
     266
     267public static function reload($data)
     268{
     269self::$installed = $data;
     270self::$installedByVendor = array();
     271}
     272
     273
     274
     275
     276
     277private static function getInstalled()
     278{
     279if (null === self::$canGetVendors) {
     280self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
     281}
     282
     283$installed = array();
     284
     285if (self::$canGetVendors) {
     286foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     287if (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
     297return $installed;
     298}
     299}
  • jpd2/tags/0.8.6/vendor/composer/autoload_real.php

    r2684482 r2684569  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitf6fc4f003c8af87f667d001c46ec3468
     5class ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInitf6fc4f003c8af87f667d001c46ec3468', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    27         spl_autoload_unregister(array('ComposerAutoloaderInitf6fc4f003c8af87f667d001c46ec3468', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8', 'loadClassLoader'));
    2828
    2929        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3131            require __DIR__ . '/autoload_static.php';
    3232
    33             call_user_func(\Composer\Autoload\ComposerStaticInitf6fc4f003c8af87f667d001c46ec3468::getInitializer($loader));
     33            call_user_func(\Composer\Autoload\ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::getInitializer($loader));
    3434        } else {
    3535            $map = require __DIR__ . '/autoload_namespaces.php';
  • jpd2/tags/0.8.6/vendor/composer/autoload_static.php

    r2684482 r2684569  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitf6fc4f003c8af87f667d001c46ec3468
     7class ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    2828    {
    2929        return \Closure::bind(function () use ($loader) {
    30             $loader->prefixLengthsPsr4 = ComposerStaticInitf6fc4f003c8af87f667d001c46ec3468::$prefixLengthsPsr4;
    31             $loader->prefixDirsPsr4 = ComposerStaticInitf6fc4f003c8af87f667d001c46ec3468::$prefixDirsPsr4;
    32             $loader->classMap = ComposerStaticInitf6fc4f003c8af87f667d001c46ec3468::$classMap;
     30            $loader->prefixLengthsPsr4 = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$prefixLengthsPsr4;
     31            $loader->prefixDirsPsr4 = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$prefixDirsPsr4;
     32            $loader->classMap = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$classMap;
    3333
    3434        }, 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 (
    118    ),
    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',
    2222    ),
     23  ),
    2324);
  • jpd2/trunk/jpd2.php

    r2684482 r2684569  
    44Plugin URI: http://joshpress.net/blog/jpd2/
    55Description: Makes caching WordPress queries via the Transients API easy.
    6 Version: 0.8.4
     6Version: 0.8.6
    77Author: Josh Pollock
    88Author URI: http://www.JoshPress.net
  • jpd2/trunk/readme.txt

    r2684482 r2684569  
    66Requires at least: 3.8
    77Tested up to: 3.8.1
    8 Stable tag: 0.8.4
     8Stable tag: 0.8.6
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • jpd2/trunk/vendor/autoload.php

    r2684482 r2684569  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitf6fc4f003c8af87f667d001c46ec3468::getLoader();
     7return ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8::getLoader();
  • jpd2/trunk/vendor/composer/ClassLoader.php

    r2684481 r2684569  
    4343class ClassLoader
    4444{
    45     /** @var ?string */
    4645    private $vendorDir;
    4746
    4847    // PSR-4
    49     /**
    50      * @var array[]
    51      * @psalm-var array<string, array<string, int>>
    52      */
    5348    private $prefixLengthsPsr4 = array();
    54     /**
    55      * @var array[]
    56      * @psalm-var array<string, array<int, string>>
    57      */
    5849    private $prefixDirsPsr4 = array();
    59     /**
    60      * @var array[]
    61      * @psalm-var array<string, string>
    62      */
    6350    private $fallbackDirsPsr4 = array();
    6451
    6552    // PSR-0
    66     /**
    67      * @var array[]
    68      * @psalm-var array<string, array<string, string[]>>
    69      */
    7053    private $prefixesPsr0 = array();
    71     /**
    72      * @var array[]
    73      * @psalm-var array<string, string>
    74      */
    7554    private $fallbackDirsPsr0 = array();
    7655
    77     /** @var bool */
    7856    private $useIncludePath = false;
    79 
    80     /**
    81      * @var string[]
    82      * @psalm-var array<string, string>
    83      */
    8457    private $classMap = array();
    85 
    86     /** @var bool */
    8758    private $classMapAuthoritative = false;
    88 
    89     /**
    90      * @var bool[]
    91      * @psalm-var array<string, bool>
    92      */
    9359    private $missingClasses = array();
    94 
    95     /** @var ?string */
    9660    private $apcuPrefix;
    9761
    98     /**
    99      * @var self[]
    100      */
    10162    private static $registeredLoaders = array();
    10263
    103     /**
    104      * @param ?string $vendorDir
    105      */
    10664    public function __construct($vendorDir = null)
    10765    {
     
    10967    }
    11068
    111     /**
    112      * @return string[]
    113      */
    11469    public function getPrefixes()
    11570    {
     
    12176    }
    12277
    123     /**
    124      * @return array[]
    125      * @psalm-return array<string, array<int, string>>
    126      */
    12778    public function getPrefixesPsr4()
    12879    {
     
    13081    }
    13182
    132     /**
    133      * @return array[]
    134      * @psalm-return array<string, string>
    135      */
    13683    public function getFallbackDirs()
    13784    {
     
    13986    }
    14087
    141     /**
    142      * @return array[]
    143      * @psalm-return array<string, string>
    144      */
    14588    public function getFallbackDirsPsr4()
    14689    {
     
    14891    }
    14992
    150     /**
    151      * @return string[] Array of classname => path
    152      * @psalm-return array<string, string>
    153      */
    15493    public function getClassMap()
    15594    {
     
    15897
    15998    /**
    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
    164100     */
    165101    public function addClassMap(array $classMap)
     
    176112     * appending or prepending to the ones previously set for this prefix.
    177113     *
    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
    183117     */
    184118    public function add($prefix, $paths, $prepend = false)
     
    223157     * appending or prepending to the ones previously set for this namespace.
    224158     *
    225      * @param string          $prefix  The prefix/namespace, with trailing '\\'
    226      * @param string[]|string $paths   The PSR-4 base directories
    227      * @param bool            $prepend Whether to prepend the directories
     159     * @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
    228162     *
    229163     * @throws \InvalidArgumentException
    230      *
    231      * @return void
    232164     */
    233165    public function addPsr4($prefix, $paths, $prepend = false)
     
    273205     * replacing any others previously set for this prefix.
    274206     *
    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
    279209     */
    280210    public function set($prefix, $paths)
     
    291221     * replacing any others previously set for this namespace.
    292222     *
    293      * @param string          $prefix The prefix/namespace, with trailing '\\'
    294      * @param string[]|string $paths  The PSR-4 base directories
     223     * @param string       $prefix The prefix/namespace, with trailing '\\'
     224     * @param array|string $paths  The PSR-4 base directories
    295225     *
    296226     * @throws \InvalidArgumentException
    297      *
    298      * @return void
    299227     */
    300228    public function setPsr4($prefix, $paths)
     
    316244     *
    317245     * @param bool $useIncludePath
    318      *
    319      * @return void
    320246     */
    321247    public function setUseIncludePath($useIncludePath)
     
    340266     *
    341267     * @param bool $classMapAuthoritative
    342      *
    343      * @return void
    344268     */
    345269    public function setClassMapAuthoritative($classMapAuthoritative)
     
    362286     *
    363287     * @param string|null $apcuPrefix
    364      *
    365      * @return void
    366288     */
    367289    public function setApcuPrefix($apcuPrefix)
     
    384306     *
    385307     * @param bool $prepend Whether to prepend the autoloader or not
    386      *
    387      * @return void
    388308     */
    389309    public function register($prepend = false)
     
    405325    /**
    406326     * Unregisters this instance as an autoloader.
    407      *
    408      * @return void
    409327     */
    410328    public function unregister()
     
    421339     *
    422340     * @param  string    $class The name of the class
    423      * @return true|null True if loaded, null otherwise
     341     * @return bool|null True if loaded, null otherwise
    424342     */
    425343    public function loadClass($class)
     
    430348            return true;
    431349        }
    432 
    433         return null;
    434350    }
    435351
     
    486402    }
    487403
    488     /**
    489      * @param  string       $class
    490      * @param  string       $ext
    491      * @return string|false
    492      */
    493404    private function findFileWithExtension($class, $ext)
    494405    {
     
    562473 *
    563474 * Prevents access to $this/self from included files.
    564  *
    565  * @param  string $file
    566  * @return void
    567  * @private
    568475 */
    569476function includeFile($file)
  • jpd2/trunk/vendor/composer/InstalledVersions.php

    r2684481 r2684569  
    11<?php
    22
    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
    1212
    1313namespace Composer;
     
    1616use Composer\Semver\VersionParser;
    1717
    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
    2525class InstalledVersions
    2626{
    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 }
     27private 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);
     51private static $canGetVendors;
     52private static $installedByVendor = array();
     53
     54
     55
     56
     57
     58
     59
     60public static function getInstalledPackages()
     61{
     62$packages = array();
     63foreach (self::getInstalled() as $installed) {
     64$packages[] = array_keys($installed['versions']);
     65}
     66
     67if (1 === \count($packages)) {
     68return $packages[0];
     69}
     70
     71return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
     72}
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82public static function isInstalled($packageName)
     83{
     84foreach (self::getInstalled() as $installed) {
     85if (isset($installed['versions'][$packageName])) {
     86return true;
     87}
     88}
     89
     90return false;
     91}
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106public static function satisfies(VersionParser $parser, $packageName, $constraint)
     107{
     108$constraint = $parser->parseConstraints($constraint);
     109$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
     110
     111return $provided->matches($constraint);
     112}
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123public static function getVersionRanges($packageName)
     124{
     125foreach (self::getInstalled() as $installed) {
     126if (!isset($installed['versions'][$packageName])) {
     127continue;
     128}
     129
     130$ranges = array();
     131if (isset($installed['versions'][$packageName]['pretty_version'])) {
     132$ranges[] = $installed['versions'][$packageName]['pretty_version'];
     133}
     134if (array_key_exists('aliases', $installed['versions'][$packageName])) {
     135$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
     136}
     137if (array_key_exists('replaced', $installed['versions'][$packageName])) {
     138$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
     139}
     140if (array_key_exists('provided', $installed['versions'][$packageName])) {
     141$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
     142}
     143
     144return implode(' || ', $ranges);
     145}
     146
     147throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     148}
     149
     150
     151
     152
     153
     154public static function getVersion($packageName)
     155{
     156foreach (self::getInstalled() as $installed) {
     157if (!isset($installed['versions'][$packageName])) {
     158continue;
     159}
     160
     161if (!isset($installed['versions'][$packageName]['version'])) {
     162return null;
     163}
     164
     165return $installed['versions'][$packageName]['version'];
     166}
     167
     168throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     169}
     170
     171
     172
     173
     174
     175public static function getPrettyVersion($packageName)
     176{
     177foreach (self::getInstalled() as $installed) {
     178if (!isset($installed['versions'][$packageName])) {
     179continue;
     180}
     181
     182if (!isset($installed['versions'][$packageName]['pretty_version'])) {
     183return null;
     184}
     185
     186return $installed['versions'][$packageName]['pretty_version'];
     187}
     188
     189throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     190}
     191
     192
     193
     194
     195
     196public static function getReference($packageName)
     197{
     198foreach (self::getInstalled() as $installed) {
     199if (!isset($installed['versions'][$packageName])) {
     200continue;
     201}
     202
     203if (!isset($installed['versions'][$packageName]['reference'])) {
     204return null;
     205}
     206
     207return $installed['versions'][$packageName]['reference'];
     208}
     209
     210throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     211}
     212
     213
     214
     215
     216
     217public static function getRootPackage()
     218{
     219$installed = self::getInstalled();
     220
     221return $installed[0]['root'];
     222}
     223
     224
     225
     226
     227
     228
     229
     230
     231public 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
     235return self::$installed;
     236}
     237
     238
     239
     240
     241
     242
     243
     244public static function getAllRawData()
     245{
     246return self::getInstalled();
     247}
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
     263
     264
     265
     266
     267public static function reload($data)
     268{
     269self::$installed = $data;
     270self::$installedByVendor = array();
     271}
     272
     273
     274
     275
     276
     277private static function getInstalled()
     278{
     279if (null === self::$canGetVendors) {
     280self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
     281}
     282
     283$installed = array();
     284
     285if (self::$canGetVendors) {
     286foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     287if (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
     297return $installed;
     298}
     299}
  • jpd2/trunk/vendor/composer/autoload_real.php

    r2684482 r2684569  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitf6fc4f003c8af87f667d001c46ec3468
     5class ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInitf6fc4f003c8af87f667d001c46ec3468', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    27         spl_autoload_unregister(array('ComposerAutoloaderInitf6fc4f003c8af87f667d001c46ec3468', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInita95a59dcb8aa0b3c27d55817c6fedbb8', 'loadClassLoader'));
    2828
    2929        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3131            require __DIR__ . '/autoload_static.php';
    3232
    33             call_user_func(\Composer\Autoload\ComposerStaticInitf6fc4f003c8af87f667d001c46ec3468::getInitializer($loader));
     33            call_user_func(\Composer\Autoload\ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::getInitializer($loader));
    3434        } else {
    3535            $map = require __DIR__ . '/autoload_namespaces.php';
  • jpd2/trunk/vendor/composer/autoload_static.php

    r2684482 r2684569  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitf6fc4f003c8af87f667d001c46ec3468
     7class ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    2828    {
    2929        return \Closure::bind(function () use ($loader) {
    30             $loader->prefixLengthsPsr4 = ComposerStaticInitf6fc4f003c8af87f667d001c46ec3468::$prefixLengthsPsr4;
    31             $loader->prefixDirsPsr4 = ComposerStaticInitf6fc4f003c8af87f667d001c46ec3468::$prefixDirsPsr4;
    32             $loader->classMap = ComposerStaticInitf6fc4f003c8af87f667d001c46ec3468::$classMap;
     30            $loader->prefixLengthsPsr4 = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$prefixLengthsPsr4;
     31            $loader->prefixDirsPsr4 = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$prefixDirsPsr4;
     32            $loader->classMap = ComposerStaticInita95a59dcb8aa0b3c27d55817c6fedbb8::$classMap;
    3333
    3434        }, 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 (
    118    ),
    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',
    2222    ),
     23  ),
    2324);
Note: See TracChangeset for help on using the changeset viewer.