Plugin Directory

Changeset 2981863

Timestamp:
10/20/2023 07:21:07 PM (10 months ago)
Author:
jarednova
Message:

Update to 1.23.0

Location:
timber-library/trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • timber-library/trunk/lib/Admin.php

    r2196766 r2981863  
    77    public static function init() {
    88        $filter = add_filter('plugin_row_meta', array(__CLASS__, 'meta_links'), 10, 2);
     9
    910        $action = add_action('in_plugin_update_message-timber-library/timber.php', array(__CLASS__, 'in_plugin_update_message'), 10, 2);
    1011        $action = add_action('in_plugin_update_message-timber/timber.php', array(__CLASS__, 'in_plugin_update_message'), 10, 2);
     
    1213            return true;
    1314        }
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
    1426    }
    1527
  • timber-library/trunk/lib/Helper.php

    r2369080 r2981863  
    517517     * If no match is found the function will return the inital argument.
    518518     *
    519      * @param mix $obj WP Object
    520      * @return mix Instance of equivalent Timber object, or the argument if no match is found
     519     * @param mix $obj WP Object
     520     * @return mix Instance of equivalent Timber object, or the argument if no match is found
    521521     */
    522522    public static function convert_wp_object( $obj ) {
  • timber-library/trunk/lib/Timber.php

    r2823298 r2981863  
    3636class Timber {
    3737
    38     public static $version = '1.22.1';
     38    public static $version = '1.2';
    3939    public static $locations;
    4040    public static $dirname = 'views';
  • timber-library/trunk/vendor/autoload.php

    r2823301 r2981863  
    33// autoload.php @generated by Composer
    44
     5
     6
     7
     8
     9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
    523require_once __DIR__ . '/composer/autoload_real.php';
    624
    7 return ComposerAutoloaderInite81ff2a27757974c68c8287e7b69363f::getLoader();
     25return ComposerAutoloaderInit::getLoader();
  • timber-library/trunk/vendor/composer/ClassLoader.php

    r2746632 r2981863  
    4343class ClassLoader
    4444{
     45
     46
     47
     48
    4549    private $vendorDir;
    4650
    4751    // PSR-4
     52
     53
     54
    4855    private $prefixLengthsPsr4 = array();
     56
     57
     58
    4959    private $prefixDirsPsr4 = array();
     60
     61
     62
    5063    private $fallbackDirsPsr4 = array();
    5164
    5265    // PSR-0
     66
     67
     68
     69
     70
     71
     72
    5373    private $prefixesPsr0 = array();
     74
     75
     76
    5477    private $fallbackDirsPsr0 = array();
    5578
     79
    5680    private $useIncludePath = false;
     81
     82
     83
     84
    5785    private $classMap = array();
     86
     87
    5888    private $classMapAuthoritative = false;
     89
     90
     91
     92
    5993    private $missingClasses = array();
     94
     95
    6096    private $apcuPrefix;
    6197
     98
     99
     100
    62101    private static $registeredLoaders = array();
    63102
     103
     104
     105
    64106    public function __construct($vendorDir = null)
    65107    {
    66108        $this->vendorDir = $vendorDir;
    67     }
    68 
     109        self::initializeIncludeClosure();
     110    }
     111
     112    /**
     113     * @return array<string, list<string>>
     114     */
    69115    public function getPrefixes()
    70116    {
     
    76122    }
    77123
     124
     125
     126
    78127    public function getPrefixesPsr4()
    79128    {
     
    81130    }
    82131
     132
     133
     134
    83135    public function getFallbackDirs()
    84136    {
     
    86138    }
    87139
     140
     141
     142
    88143    public function getFallbackDirsPsr4()
    89144    {
     
    91146    }
    92147
     148
     149
     150
    93151    public function getClassMap()
    94152    {
     
    97155
    98156    /**
    99      * @param array $classMap Class to filename map
     157     * @param array<string, string> $classMap Class to filename map
     158     *
     159     * @return void
    100160     */
    101161    public function addClassMap(array $classMap)
     
    112172     * appending or prepending to the ones previously set for this prefix.
    113173     *
    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
     174     * @param string              $prefix  The prefix
     175     * @param list<string>|string $paths   The PSR-0 root directories
     176     * @param bool                $prepend Whether to prepend the directories
     177     *
     178     * @return void
    117179     */
    118180    public function add($prefix, $paths, $prepend = false)
    119181    {
     182
    120183        if (!$prefix) {
    121184            if ($prepend) {
    122185                $this->fallbackDirsPsr0 = array_merge(
    123                     (array) $paths,
     186                    $paths,
    124187                    $this->fallbackDirsPsr0
    125188                );
     
    127190                $this->fallbackDirsPsr0 = array_merge(
    128191                    $this->fallbackDirsPsr0,
    129                     (array) $paths
     192                    $paths
    130193                );
    131194            }
     
    136199        $first = $prefix[0];
    137200        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    138             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
     201            $this->prefixesPsr0[$first][$prefix] = $paths;
    139202
    140203            return;
     
    142205        if ($prepend) {
    143206            $this->prefixesPsr0[$first][$prefix] = array_merge(
    144                 (array) $paths,
     207                $paths,
    145208                $this->prefixesPsr0[$first][$prefix]
    146209            );
     
    148211            $this->prefixesPsr0[$first][$prefix] = array_merge(
    149212                $this->prefixesPsr0[$first][$prefix],
    150                 (array) $paths
     213                $paths
    151214            );
    152215        }
     
    157220     * appending or prepending to the ones previously set for this namespace.
    158221     *
    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
     222     * @param string       $prefix  The prefix/namespace, with trailing '\\'
     223     * @param |string $paths   The PSR-4 base directories
     224     * @param bool         $prepend Whether to prepend the directories
    162225     *
    163226     * @throws \InvalidArgumentException
     227
     228
    164229     */
    165230    public function addPsr4($prefix, $paths, $prepend = false)
    166231    {
     232
    167233        if (!$prefix) {
    168234            // Register directories for the root namespace.
    169235            if ($prepend) {
    170236                $this->fallbackDirsPsr4 = array_merge(
    171                     (array) $paths,
     237                    $paths,
    172238                    $this->fallbackDirsPsr4
    173239                );
     
    175241                $this->fallbackDirsPsr4 = array_merge(
    176242                    $this->fallbackDirsPsr4,
    177                     (array) $paths
     243                    $paths
    178244                );
    179245            }
     
    185251            }
    186252            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    187             $this->prefixDirsPsr4[$prefix] = (array) $paths;
     253            $this->prefixDirsPsr4[$prefix] = $paths;
    188254        } elseif ($prepend) {
    189255            // Prepend directories for an already registered namespace.
    190256            $this->prefixDirsPsr4[$prefix] = array_merge(
    191                 (array) $paths,
     257                $paths,
    192258                $this->prefixDirsPsr4[$prefix]
    193259            );
     
    196262            $this->prefixDirsPsr4[$prefix] = array_merge(
    197263                $this->prefixDirsPsr4[$prefix],
    198                 (array) $paths
     264                $paths
    199265            );
    200266        }
     
    205271     * replacing any others previously set for this prefix.
    206272     *
    207      * @param string       $prefix The prefix
    208      * @param array|string $paths  The PSR-0 base directories
     273     * @param string              $prefix The prefix
     274     * @param list<string>|string $paths  The PSR-0 base directories
     275     *
     276     * @return void
    209277     */
    210278    public function set($prefix, $paths)
     
    221289     * replacing any others previously set for this namespace.
    222290     *
    223      * @param string       $prefix The prefix/namespace, with trailing '\\'
    224      * @param array|string $paths  The PSR-4 base directories
     291     * @param string       $prefix The prefix/namespace, with trailing '\\'
     292     * @param |string $paths  The PSR-4 base directories
    225293     *
    226294     * @throws \InvalidArgumentException
     295
     296
    227297     */
    228298    public function setPsr4($prefix, $paths)
     
    244314     *
    245315     * @param bool $useIncludePath
     316
     317
    246318     */
    247319    public function setUseIncludePath($useIncludePath)
     
    266338     *
    267339     * @param bool $classMapAuthoritative
     340
     341
    268342     */
    269343    public function setClassMapAuthoritative($classMapAuthoritative)
     
    286360     *
    287361     * @param string|null $apcuPrefix
     362
     363
    288364     */
    289365    public function setApcuPrefix($apcuPrefix)
     
    306382     *
    307383     * @param bool $prepend Whether to prepend the autoloader or not
     384
     385
    308386     */
    309387    public function register($prepend = false)
     
    325403    /**
    326404     * Unregisters this instance as an autoloader.
     405
     406
    327407     */
    328408    public function unregister()
     
    339419     *
    340420     * @param  string    $class The name of the class
    341      * @return bool|null True if loaded, null otherwise
     421     * @return |null True if loaded, null otherwise
    342422     */
    343423    public function loadClass($class)
    344424    {
    345425        if ($file = $this->findFile($class)) {
    346             includeFile($file);
     426            $includeFile = self::$includeFile;
     427            $includeFile($file);
    347428
    348429            return true;
    349430        }
     431
     432
    350433    }
    351434
     
    393476
    394477    /**
    395      * Returns the currently registered loaders indexed by their corresponding vendor directories.
    396      *
    397      * @return self[]
     478     * Returns the currently registered loaders ed by their corresponding vendor directories.
     479     *
     480     * @return
    398481     */
    399482    public static function getRegisteredLoaders()
     
    402485    }
    403486
     487
     488
     489
     490
     491
    404492    private function findFileWithExtension($class, $ext)
    405493    {
     
    467555        return false;
    468556    }
     557
     558
     559
     560
     561
     562
     563
     564
     565
     566
     567
     568
     569
     570
     571
     572
     573
     574
     575
     576
     577
     578
    469579}
    470 
    471 /**
    472  * Scope isolated include.
    473  *
    474  * Prevents access to $this/self from included files.
    475  */
    476 function includeFile($file)
    477 {
    478     include $file;
    479 }
  • timber-library/trunk/vendor/composer/InstalledVersions.php

    r2823301 r2981863  
    11<?php
    22
    3 
    4 
    5 
    6 
    7 
    8 
    9 
    10 
    11 
     3/*
     4 * This file is part of Composer.
     5 *
     6 * (c) Nils Adermann <naderman@naderman.de>
     7 *     Jordi Boggiano <j.boggiano@seld.be>
     8 *
     9 * For the full copyright and license information, please view the LICENSE
     10 * file that was distributed with this source code.
     11 */
    1212
    1313namespace Composer;
     
    1616use Composer\Semver\VersionParser;
    1717
    18 
    19 
    20 
    21 
    22 
     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 *
     25 * @final
     26 */
    2327class InstalledVersions
    2428{
    25 private static $installed = array (
    26   'root' =>
    27   array (
    28     'pretty_version' => '1.22.1.x-dev',
    29     'version' => '1.22.1.9999999-dev',
    30     'aliases' =>
    31     array (
    32     ),
    33     'reference' => '57fc582c42519f1b05fff5fb2ebf4291b5cd638f',
    34     'name' => 'timber/timber',
    35   ),
    36   'versions' =>
    37   array (
    38     'altorouter/altorouter' =>
    39     array (
    40       'pretty_version' => '2.0.2',
    41       'version' => '2.0.2.0',
    42       'aliases' =>
    43       array (
    44       ),
    45       'reference' => 'f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2',
    46     ),
    47     'composer/installers' =>
    48     array (
    49       'pretty_version' => 'v2.2.0',
    50       'version' => '2.2.0.0',
    51       'aliases' =>
    52       array (
    53       ),
    54       'reference' => 'c29dc4b93137acb82734f672c37e029dfbd95b35',
    55     ),
    56     'symfony/polyfill-ctype' =>
    57     array (
    58       'pretty_version' => 'v1.27.0',
    59       'version' => '1.27.0.0',
    60       'aliases' =>
    61       array (
    62       ),
    63       'reference' => '5bbc823adecdae860bb64756d639ecfec17b050a',
    64     ),
    65     'timber/timber' =>
    66     array (
    67       'pretty_version' => '1.22.1.x-dev',
    68       'version' => '1.22.1.9999999-dev',
    69       'aliases' =>
    70       array (
    71       ),
    72       'reference' => '57fc582c42519f1b05fff5fb2ebf4291b5cd638f',
    73     ),
    74     'twig/cache-extension' =>
    75     array (
    76       'pretty_version' => 'v1.5.0',
    77       'version' => '1.5.0.0',
    78       'aliases' =>
    79       array (
    80       ),
    81       'reference' => '2c243643f59132194458bd03c745b079bbb12e78',
    82     ),
    83     'twig/twig' =>
    84     array (
    85       'pretty_version' => 'v1.44.7',
    86       'version' => '1.44.7.0',
    87       'aliases' =>
    88       array (
    89       ),
    90       'reference' => '0887422319889e442458e48e2f3d9add1a172ad5',
    91     ),
    92     'upstatement/routes' =>
    93     array (
    94       'pretty_version' => '0.9.1',
    95       'version' => '0.9.1.0',
    96       'aliases' =>
    97       array (
    98       ),
    99       'reference' => 'cac3c844ab824e4039fd26edbea5402415aa6d0a',
    100     ),
    101   ),
    102 );
    103 private static $canGetVendors;
    104 private static $installedByVendor = array();
    105 
    106 
    107 
    108 
    109 
    110 
    111 
    112 public static function getInstalledPackages()
    113 {
    114 $packages = array();
    115 foreach (self::getInstalled() as $installed) {
    116 $packages[] = array_keys($installed['versions']);
     29    /**
     30     * @var mixed[]|null
     31     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
     32     */
     33    private static $installed;
     34
     35    /**
     36     * @var bool|null
     37     */
     38    private static $canGetVendors;
     39
     40    /**
     41     * @var array[]
     42     * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
     43     */
     44    private static $installedByVendor = array();
     45
     46    /**
     47     * Returns a list of all package names which are present, either by being installed, replaced or provided
     48     *
     49     * @return string[]
     50     * @psalm-return list<string>
     51     */
     52    public static function getInstalledPackages()
     53    {
     54        $packages = array();
     55        foreach (self::getInstalled() as $installed) {
     56            $packages[] = array_keys($installed['versions']);
     57        }
     58
     59        if (1 === \count($packages)) {
     60            return $packages[0];
     61        }
     62
     63        return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
     64    }
     65
     66    /**
     67     * Returns a list of all package names with a specific type e.g. 'library'
     68     *
     69     * @param  string   $type
     70     * @return string[]
     71     * @psalm-return list<string>
     72     */
     73    public static function getInstalledPackagesByType($type)
     74    {
     75        $packagesByType = array();
     76
     77        foreach (self::getInstalled() as $installed) {
     78            foreach ($installed['versions'] as $name => $package) {
     79                if (isset($package['type']) && $package['type'] === $type) {
     80                    $packagesByType[] = $name;
     81                }
     82            }
     83        }
     84
     85        return $packagesByType;
     86    }
     87
     88    /**
     89     * Checks whether the given package is installed
     90     *
     91     * This also returns true if the package name is provided or replaced by another package
     92     *
     93     * @param  string $packageName
     94     * @param  bool   $includeDevRequirements
     95     * @return bool
     96     */
     97    public static function isInstalled($packageName, $includeDevRequirements = true)
     98    {
     99        foreach (self::getInstalled() as $installed) {
     100            if (isset($installed['versions'][$packageName])) {
     101                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
     102            }
     103        }
     104
     105        return false;
     106    }
     107
     108    /**
     109     * Checks whether the given package satisfies a version constraint
     110     *
     111     * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
     112     *
     113     *   Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
     114     *
     115     * @param  VersionParser $parser      Install composer/semver to have access to this class and functionality
     116     * @param  string        $packageName
     117     * @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
     118     * @return bool
     119     */
     120    public static function satisfies(VersionParser $parser, $packageName, $constraint)
     121    {
     122        $constraint = $parser->parseConstraints((string) $constraint);
     123        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
     124
     125        return $provided->matches($constraint);
     126    }
     127
     128    /**
     129     * Returns a version constraint representing all the range(s) which are installed for a given package
     130     *
     131     * It is easier to use this via isInstalled() with the $constraint argument if you need to check
     132     * whether a given version of a package is installed, and not just whether it exists
     133     *
     134     * @param  string $packageName
     135     * @return string Version constraint usable with composer/semver
     136     */
     137    public static function getVersionRanges($packageName)
     138    {
     139        foreach (self::getInstalled() as $installed) {
     140            if (!isset($installed['versions'][$packageName])) {
     141                continue;
     142            }
     143
     144            $ranges = array();
     145            if (isset($installed['versions'][$packageName]['pretty_version'])) {
     146                $ranges[] = $installed['versions'][$packageName]['pretty_version'];
     147            }
     148            if (array_key_exists('aliases', $installed['versions'][$packageName])) {
     149                $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
     150            }
     151            if (array_key_exists('replaced', $installed['versions'][$packageName])) {
     152                $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
     153            }
     154            if (array_key_exists('provided', $installed['versions'][$packageName])) {
     155                $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
     156            }
     157
     158            return implode(' || ', $ranges);
     159        }
     160
     161        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     162    }
     163
     164    /**
     165     * @param  string      $packageName
     166     * @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
     167     */
     168    public static function getVersion($packageName)
     169    {
     170        foreach (self::getInstalled() as $installed) {
     171            if (!isset($installed['versions'][$packageName])) {
     172                continue;
     173            }
     174
     175            if (!isset($installed['versions'][$packageName]['version'])) {
     176                return null;
     177            }
     178
     179            return $installed['versions'][$packageName]['version'];
     180        }
     181
     182        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     183    }
     184
     185    /**
     186     * @param  string      $packageName
     187     * @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
     188     */
     189    public static function getPrettyVersion($packageName)
     190    {
     191        foreach (self::getInstalled() as $installed) {
     192            if (!isset($installed['versions'][$packageName])) {
     193                continue;
     194            }
     195
     196            if (!isset($installed['versions'][$packageName]['pretty_version'])) {
     197                return null;
     198            }
     199
     200            return $installed['versions'][$packageName]['pretty_version'];
     201        }
     202
     203        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     204    }
     205
     206    /**
     207     * @param  string      $packageName
     208     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
     209     */
     210    public static function getReference($packageName)
     211    {
     212        foreach (self::getInstalled() as $installed) {
     213            if (!isset($installed['versions'][$packageName])) {
     214                continue;
     215            }
     216
     217            if (!isset($installed['versions'][$packageName]['reference'])) {
     218                return null;
     219            }
     220
     221            return $installed['versions'][$packageName]['reference'];
     222        }
     223
     224        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     225    }
     226
     227    /**
     228     * @param  string      $packageName
     229     * @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.
     230     */
     231    public static function getInstallPath($packageName)
     232    {
     233        foreach (self::getInstalled() as $installed) {
     234            if (!isset($installed['versions'][$packageName])) {
     235                continue;
     236            }
     237
     238            return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
     239        }
     240
     241        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     242    }
     243
     244    /**
     245     * @return array
     246     * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
     247     */
     248    public static function getRootPackage()
     249    {
     250        $installed = self::getInstalled();
     251
     252        return $installed[0]['root'];
     253    }
     254
     255    /**
     256     * Returns the raw installed.php data for custom implementations
     257     *
     258     * @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.
     259     * @return array[]
     260     * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
     261     */
     262    public static function getRawData()
     263    {
     264        @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);
     265
     266        if (null === self::$installed) {
     267            // only require the installed.php file if this file is loaded from its dumped location,
     268            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
     269            if (substr(__DIR__, -8, 1) !== 'C') {
     270                self::$installed = include __DIR__ . '/installed.php';
     271            } else {
     272                self::$installed = array();
     273            }
     274        }
     275
     276        return self::$installed;
     277    }
     278
     279    /**
     280     * Returns the raw data of all installed.php which are currently loaded for custom implementations
     281     *
     282     * @return array[]
     283     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
     284     */
     285    public static function getAllRawData()
     286    {
     287        return self::getInstalled();
     288    }
     289
     290    /**
     291     * Lets you reload the static array from another file
     292     *
     293     * This is only useful for complex integrations in which a project needs to use
     294     * this class but then also needs to execute another project's autoloader in process,
     295     * and wants to ensure both projects have access to their version of installed.php.
     296     *
     297     * A typical case would be PHPUnit, where it would need to make sure it reads all
     298     * the data it needs from this class, then call reload() with
     299     * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
     300     * the project in which it runs can then also use this class safely, without
     301     * interference between PHPUnit's dependencies and the project's dependencies.
     302     *
     303     * @param  array[] $data A vendor/composer/installed.php data set
     304     * @return void
     305     *
     306     * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
     307     */
     308    public static function reload($data)
     309    {
     310        self::$installed = $data;
     311        self::$installedByVendor = array();
     312    }
     313
     314    /**
     315     * @return array[]
     316     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
     317     */
     318    private static function getInstalled()
     319    {
     320        if (null === self::$canGetVendors) {
     321            self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
     322        }
     323
     324        $installed = array();
     325
     326        if (self::$canGetVendors) {
     327            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     328                if (isset(self::$installedByVendor[$vendorDir])) {
     329                    $installed[] = self::$installedByVendor[$vendorDir];
     330                } elseif (is_file($vendorDir.'/composer/installed.php')) {
     331                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     332                    $required = require $vendorDir.'/composer/installed.php';
     333                    $installed[] = self::$installedByVendor[$vendorDir] = $required;
     334                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
     335                        self::$installed = $installed[count($installed) - 1];
     336                    }
     337                }
     338            }
     339        }
     340
     341        if (null === self::$installed) {
     342            // only require the installed.php file if this file is loaded from its dumped location,
     343            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
     344            if (substr(__DIR__, -8, 1) !== 'C') {
     345                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     346                $required = require __DIR__ . '/installed.php';
     347                self::$installed = $required;
     348            } else {
     349                self::$installed = array();
     350            }
     351        }
     352
     353        if (self::$installed !== array()) {
     354            $installed[] = self::$installed;
     355        }
     356
     357        return $installed;
     358    }
    117359}
    118 
    119 
    120 if (1 === \count($packages)) {
    121 return $packages[0];
    122 }
    123 
    124 return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
    125 }
    126 
    127 
    128 
    129 
    130 
    131 
    132 
    133 
    134 
    135 public static function isInstalled($packageName)
    136 {
    137 foreach (self::getInstalled() as $installed) {
    138 if (isset($installed['versions'][$packageName])) {
    139 return true;
    140 }
    141 }
    142 
    143 return false;
    144 }
    145 
    146 
    147 
    148 
    149 
    150 
    151 
    152 
    153 
    154 
    155 
    156 
    157 
    158 
    159 public static function satisfies(VersionParser $parser, $packageName, $constraint)
    160 {
    161 $constraint = $parser->parseConstraints($constraint);
    162 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    163 
    164 return $provided->matches($constraint);
    165 }
    166 
    167 
    168 
    169 
    170 
    171 
    172 
    173 
    174 
    175 
    176 public static function getVersionRanges($packageName)
    177 {
    178 foreach (self::getInstalled() as $installed) {
    179 if (!isset($installed['versions'][$packageName])) {
    180 continue;
    181 }
    182 
    183 $ranges = array();
    184 if (isset($installed['versions'][$packageName]['pretty_version'])) {
    185 $ranges[] = $installed['versions'][$packageName]['pretty_version'];
    186 }
    187 if (array_key_exists('aliases', $installed['versions'][$packageName])) {
    188 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
    189 }
    190 if (array_key_exists('replaced', $installed['versions'][$packageName])) {
    191 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
    192 }
    193 if (array_key_exists('provided', $installed['versions'][$packageName])) {
    194 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
    195 }
    196 
    197 return implode(' || ', $ranges);
    198 }
    199 
    200 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    201 }
    202 
    203 
    204 
    205 
    206 
    207 public static function getVersion($packageName)
    208 {
    209 foreach (self::getInstalled() as $installed) {
    210 if (!isset($installed['versions'][$packageName])) {
    211 continue;
    212 }
    213 
    214 if (!isset($installed['versions'][$packageName]['version'])) {
    215 return null;
    216 }
    217 
    218 return $installed['versions'][$packageName]['version'];
    219 }
    220 
    221 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    222 }
    223 
    224 
    225 
    226 
    227 
    228 public static function getPrettyVersion($packageName)
    229 {
    230 foreach (self::getInstalled() as $installed) {
    231 if (!isset($installed['versions'][$packageName])) {
    232 continue;
    233 }
    234 
    235 if (!isset($installed['versions'][$packageName]['pretty_version'])) {
    236 return null;
    237 }
    238 
    239 return $installed['versions'][$packageName]['pretty_version'];
    240 }
    241 
    242 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    243 }
    244 
    245 
    246 
    247 
    248 
    249 public static function getReference($packageName)
    250 {
    251 foreach (self::getInstalled() as $installed) {
    252 if (!isset($installed['versions'][$packageName])) {
    253 continue;
    254 }
    255 
    256 if (!isset($installed['versions'][$packageName]['reference'])) {
    257 return null;
    258 }
    259 
    260 return $installed['versions'][$packageName]['reference'];
    261 }
    262 
    263 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    264 }
    265 
    266 
    267 
    268 
    269 
    270 public static function getRootPackage()
    271 {
    272 $installed = self::getInstalled();
    273 
    274 return $installed[0]['root'];
    275 }
    276 
    277 
    278 
    279 
    280 
    281 
    282 
    283 public static function getRawData()
    284 {
    285 return self::$installed;
    286 }
    287 
    288 
    289 
    290 
    291 
    292 
    293 
    294 
    295 
    296 
    297 
    298 
    299 
    300 
    301 
    302 
    303 
    304 
    305 
    306 public static function reload($data)
    307 {
    308 self::$installed = $data;
    309 self::$installedByVendor = array();
    310 }
    311 
    312 
    313 
    314 
    315 private static function getInstalled()
    316 {
    317 if (null === self::$canGetVendors) {
    318 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
    319 }
    320 
    321 $installed = array();
    322 
    323 if (self::$canGetVendors) {
    324 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    325 if (isset(self::$installedByVendor[$vendorDir])) {
    326 $installed[] = self::$installedByVendor[$vendorDir];
    327 } elseif (is_file($vendorDir.'/composer/installed.php')) {
    328 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    329 }
    330 }
    331 }
    332 
    333 $installed[] = self::$installed;
    334 
    335 return $installed;
    336 }
    337 }
  • timber-library/trunk/vendor/composer/autoload_classmap.php

    r2823301 r2981863  
    33// autoload_classmap.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname();
    66$baseDir = dirname($vendorDir);
    77
  • timber-library/trunk/vendor/composer/autoload_files.php

    r2823301 r2981863  
    33// autoload_files.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname();
    66$baseDir = dirname($vendorDir);
    77
  • timber-library/trunk/vendor/composer/autoload_namespaces.php

    r1408242 r2981863  
    33// autoload_namespaces.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname();
    66$baseDir = dirname($vendorDir);
    77
  • timber-library/trunk/vendor/composer/autoload_psr4.php

    r2823301 r2981863  
    33// autoload_psr4.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname();
    66$baseDir = dirname($vendorDir);
    77
  • timber-library/trunk/vendor/composer/autoload_real.php

    r2823301 r2981863  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInite81ff2a27757974c68c8287e7b69363f
     5class ComposerAutoloaderInit
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInite81ff2a27757974c68c8287e7b69363f', 'loadClassLoader'), true, true);
    28         self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInite81ff2a27757974c68c8287e7b69363f', 'loadClassLoader'));
     27        spl_autoload_register(array('ComposerAutoloaderInit', 'loadClassLoader'), true, true);
     28        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname());
     29        spl_autoload_unregister(array('ComposerAutoloaderInit', 'loadClassLoader'));
    3030
    31         $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
    32         if ($useStaticLoader) {
    33             require __DIR__ . '/autoload_static.php';
    34 
    35             call_user_func(\Composer\Autoload\ComposerStaticInite81ff2a27757974c68c8287e7b69363f::getInitializer($loader));
    36         } else {
    37             $map = require __DIR__ . '/autoload_namespaces.php';
    38             foreach ($map as $namespace => $path) {
    39                 $loader->set($namespace, $path);
    40             }
    41 
    42             $map = require __DIR__ . '/autoload_psr4.php';
    43             foreach ($map as $namespace => $path) {
    44                 $loader->setPsr4($namespace, $path);
    45             }
    46 
    47             $classMap = require __DIR__ . '/autoload_classmap.php';
    48             if ($classMap) {
    49                 $loader->addClassMap($classMap);
    50             }
    51         }
     31        require __DIR__ . '/autoload_static.php';
     32        call_user_func(\Composer\Autoload\ComposerStaticInit267eb5d77d534d5b530cd88d018b48b3::getInitializer($loader));
    5233
    5334        $loader->register(true);
    5435
    55         if ($useStaticLoader) {
    56             $includeFiles = Composer\Autoload\ComposerStaticInite81ff2a27757974c68c8287e7b69363f::$files;
    57         } else {
    58             $includeFiles = require __DIR__ . '/autoload_files.php';
    59         }
    60         foreach ($includeFiles as $fileIdentifier => $file) {
    61             composerRequiree81ff2a27757974c68c8287e7b69363f($fileIdentifier, $file);
     36        $filesToLoad = \Composer\Autoload\ComposerStaticInit267eb5d77d534d5b530cd88d018b48b3::$files;
     37        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
     38            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
     39                $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
     40
     41                require $file;
     42            }
     43        }, null, null);
     44        foreach ($filesToLoad as $fileIdentifier => $file) {
     45            $requireFile($fileIdentifier, $file);
    6246        }
    6347
     
    6549    }
    6650}
    67 
    68 function composerRequiree81ff2a27757974c68c8287e7b69363f($fileIdentifier, $file)
    69 {
    70     if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
    71         require $file;
    72 
    73         $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
    74     }
    75 }
  • timber-library/trunk/vendor/composer/autoload_static.php

    r2823301 r2981863  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInite81ff2a27757974c68c8287e7b69363f
     7class ComposerStaticInit
    88{
    99    public static $files = array (
     
    7575    {
    7676        return \Closure::bind(function () use ($loader) {
    77             $loader->prefixLengthsPsr4 = ComposerStaticInite81ff2a27757974c68c8287e7b69363f::$prefixLengthsPsr4;
    78             $loader->prefixDirsPsr4 = ComposerStaticInite81ff2a27757974c68c8287e7b69363f::$prefixDirsPsr4;
    79             $loader->fallbackDirsPsr4 = ComposerStaticInite81ff2a27757974c68c8287e7b69363f::$fallbackDirsPsr4;
    80             $loader->prefixesPsr0 = ComposerStaticInite81ff2a27757974c68c8287e7b69363f::$prefixesPsr0;
    81             $loader->classMap = ComposerStaticInite81ff2a27757974c68c8287e7b69363f::$classMap;
     77            $loader->prefixLengthsPsr4 = ComposerStaticInit::$prefixLengthsPsr4;
     78            $loader->prefixDirsPsr4 = ComposerStaticInit::$prefixDirsPsr4;
     79            $loader->fallbackDirsPsr4 = ComposerStaticInit::$fallbackDirsPsr4;
     80            $loader->prefixesPsr0 = ComposerStaticInit::$prefixesPsr0;
     81            $loader->classMap = ComposerStaticInit::$classMap;
    8282
    8383        }, null, ClassLoader::class);
  • timber-library/trunk/vendor/composer/installed.json

    r2823301 r2981863  
    214214        {
    215215            "name": "symfony/polyfill-ctype",
    216             "version": "v1.27.0",
    217             "version_normalized": "1.27.0.0",
     216            "version": "v1.2.0",
     217            "version_normalized": "1.2.0.0",
    218218            "source": {
    219219                "type": "git",
    220220                "url": "https://github.com/symfony/polyfill-ctype.git",
    221                 "reference": "5bbc823adecdae860bb64756d639ecfec17b050a"
     221                "reference": ""
    222222            },
    223223            "dist": {
    224224                "type": "zip",
    225                 "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a",
    226                 "reference": "5bbc823adecdae860bb64756d639ecfec17b050a",
     225                "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/",
     226                "reference": "",
    227227                "shasum": ""
    228228            },
     
    236236                "ext-ctype": "For best performance"
    237237            },
    238             "time": "2022-11-03T14:55:06+00:00",
     238            "time": "202+00:00",
    239239            "type": "library",
    240240            "extra": {
    241241                "branch-alias": {
    242                     "dev-main": "1.27-dev"
     242                    "dev-main": "1.2-dev"
    243243                },
    244244                "thanks": {
     
    279279            ],
    280280            "support": {
    281                 "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0"
     281                "source": "https://github.com/symfony/polyfill-ctype/tree/v1.2.0"
    282282            },
    283283            "funding": [
  • timber-library/trunk/vendor/composer/installed.php

    r2823301 r2981863  
    1 <?php return array (
    2   'root' =>
    3   array (
    4     'pretty_version' => '1.22.1.x-dev',
    5     'version' => '1.22.1.9999999-dev',
    6     'aliases' =>
    7     array (
     1<?php return array(
     2    'root' => array(
     3        'name' => 'timber/timber',
     4        'pretty_version' => '1.23.0',
     5        'version' => '1.23.0.0',
     6        'reference' => 'b988e51e5bc9e9743745b4d3c6eba6e106fae83f',
     7        'type' => 'library',
     8        'install_path' => __DIR__ . '/../../',
     9        'aliases' => array(),
     10        'dev' => false,
    811    ),
    9     'reference' => '57fc582c42519f1b05fff5fb2ebf4291b5cd638f',
    10     'name' => 'timber/timber',
    11   ),
    12   'versions' =>
    13   array (
    14     'altorouter/altorouter' =>
    15     array (
    16       'pretty_version' => '2.0.2',
    17       'version' => '2.0.2.0',
    18       'aliases' =>
    19       array (
    20       ),
    21       'reference' => 'f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2',
     12    'versions' => array(
     13        'altorouter/altorouter' => array(
     14            'pretty_version' => '2.0.2',
     15            'version' => '2.0.2.0',
     16            'reference' => 'f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2',
     17            'type' => 'library',
     18            'install_path' => __DIR__ . '/../altorouter/altorouter',
     19            'aliases' => array(),
     20            'dev_requirement' => false,
     21        ),
     22        'composer/installers' => array(
     23            'pretty_version' => 'v2.2.0',
     24            'version' => '2.2.0.0',
     25            'reference' => 'c29dc4b93137acb82734f672c37e029dfbd95b35',
     26            'type' => 'composer-plugin',
     27            'install_path' => __DIR__ . '/./installers',
     28            'aliases' => array(),
     29            'dev_requirement' => false,
     30        ),
     31        'symfony/polyfill-ctype' => array(
     32            'pretty_version' => 'v1.28.0',
     33            'version' => '1.28.0.0',
     34            'reference' => 'ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb',
     35            'type' => 'library',
     36            'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
     37            'aliases' => array(),
     38            'dev_requirement' => false,
     39        ),
     40        'timber/timber' => array(
     41            'pretty_version' => '1.23.0',
     42            'version' => '1.23.0.0',
     43            'reference' => 'b988e51e5bc9e9743745b4d3c6eba6e106fae83f',
     44            'type' => 'library',
     45            'install_path' => __DIR__ . '/../../',
     46            'aliases' => array(),
     47            'dev_requirement' => false,
     48        ),
     49        'twig/cache-extension' => array(
     50            'pretty_version' => 'v1.5.0',
     51            'version' => '1.5.0.0',
     52            'reference' => '2c243643f59132194458bd03c745b079bbb12e78',
     53            'type' => 'library',
     54            'install_path' => __DIR__ . '/../twig/cache-extension',
     55            'aliases' => array(),
     56            'dev_requirement' => false,
     57        ),
     58        'twig/twig' => array(
     59            'pretty_version' => 'v1.44.7',
     60            'version' => '1.44.7.0',
     61            'reference' => '0887422319889e442458e48e2f3d9add1a172ad5',
     62            'type' => 'library',
     63            'install_path' => __DIR__ . '/../twig/twig',
     64            'aliases' => array(),
     65            'dev_requirement' => false,
     66        ),
     67        'upstatement/routes' => array(
     68            'pretty_version' => '0.9.1',
     69            'version' => '0.9.1.0',
     70            'reference' => 'cac3c844ab824e4039fd26edbea5402415aa6d0a',
     71            'type' => 'library',
     72            'install_path' => __DIR__ . '/../upstatement/routes',
     73            'aliases' => array(),
     74            'dev_requirement' => false,
     75        ),
    2276    ),
    23     'composer/installers' =>
    24     array (
    25       'pretty_version' => 'v2.2.0',
    26       'version' => '2.2.0.0',
    27       'aliases' =>
    28       array (
    29       ),
    30       'reference' => 'c29dc4b93137acb82734f672c37e029dfbd95b35',
    31     ),
    32     'symfony/polyfill-ctype' =>
    33     array (
    34       'pretty_version' => 'v1.27.0',
    35       'version' => '1.27.0.0',
    36       'aliases' =>
    37       array (
    38       ),
    39       'reference' => '5bbc823adecdae860bb64756d639ecfec17b050a',
    40     ),
    41     'timber/timber' =>
    42     array (
    43       'pretty_version' => '1.22.1.x-dev',
    44       'version' => '1.22.1.9999999-dev',
    45       'aliases' =>
    46       array (
    47       ),
    48       'reference' => '57fc582c42519f1b05fff5fb2ebf4291b5cd638f',
    49     ),
    50     'twig/cache-extension' =>
    51     array (
    52       'pretty_version' => 'v1.5.0',
    53       'version' => '1.5.0.0',
    54       'aliases' =>
    55       array (
    56       ),
    57       'reference' => '2c243643f59132194458bd03c745b079bbb12e78',
    58     ),
    59     'twig/twig' =>
    60     array (
    61       'pretty_version' => 'v1.44.7',
    62       'version' => '1.44.7.0',
    63       'aliases' =>
    64       array (
    65       ),
    66       'reference' => '0887422319889e442458e48e2f3d9add1a172ad5',
    67     ),
    68     'upstatement/routes' =>
    69     array (
    70       'pretty_version' => '0.9.1',
    71       'version' => '0.9.1.0',
    72       'aliases' =>
    73       array (
    74       ),
    75       'reference' => 'cac3c844ab824e4039fd26edbea5402415aa6d0a',
    76     ),
    77   ),
    7877);
  • timber-library/trunk/vendor/symfony/polyfill-ctype/LICENSE

    r2103527 r2981863  
    1 Copyright (c) 2018-2019 Fabien Potencier
     1Copyright (c) 2018- Fabien Potencier
    22
    33Permission is hereby granted, free of charge, to any person obtaining a copy
  • timber-library/trunk/vendor/symfony/polyfill-ctype/composer.json

    r2823301 r2981863  
    3232    "extra": {
    3333        "branch-alias": {
    34             "dev-main": "1.27-dev"
     34            "dev-main": "1.2-dev"
    3535        },
    3636        "thanks": {
Note: See TracChangeset for help on using the changeset viewer.