当前位置: 首页>>代码示例>>PHP>>正文


PHP Version::normalize方法代码示例

本文整理汇总了PHP中Version::normalize方法的典型用法代码示例。如果您正苦于以下问题:PHP Version::normalize方法的具体用法?PHP Version::normalize怎么用?PHP Version::normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Version的用法示例。


在下文中一共展示了Version::normalize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: collect

 /**
  * Collects versions.
  *
  * @return array[string]array
  */
 private static function collect(\ICanBoogie\Core $core)
 {
     $versions = array();
     $definitions = $core->registry->select('SUBSTR(name, LENGTH("thumbnailer.versions.") + 1) as name, value')->where('name LIKE ?', 'thumbnailer.versions.%')->pairs;
     foreach ($definitions as $name => $options) {
         if (!$options || !is_string($options) || $options[0] != '{') {
             \ICanBoogie\log_error('Bad version: %name, :options', array('name' => $name, 'options' => $options));
             continue;
         }
         $versions[$name] = Version::normalize(json_decode($options, true));
     }
     return $versions;
 }
开发者ID:icybee,项目名称:module-thumbnailer,代码行数:18,代码来源:versions.php

示例2: getOutdatedPackages

 /**
  * Get outdated packages with their current and latest version.
  *
  * @return array
  */
 public function getOutdatedPackages()
 {
     // Get all installed and required packages.
     $installed = $this->composer->getInstalledPackages();
     $required = $this->composer->getRequiredPackages();
     $outdated = [];
     // Get the installed version number of the required packages.
     $packages = array_intersect_key($installed, $required);
     foreach ($packages as $name => $version) {
         $package = new Package($name, Version::normalize($version), $required[$name]);
         if ($package->isOutdated()) {
             $outdated[] = $package;
         }
     }
     return $outdated;
 }
开发者ID:mbrodala,项目名称:climb,代码行数:21,代码来源:Ladder.php

示例3: getOutdatedPackages

 /**
  * Get outdated packages with their current and latest version.
  *
  * @param array $excluded
  *
  * @return array
  */
 public function getOutdatedPackages(array $excluded = [])
 {
     // Get all installed and required packages.
     $installed = $this->composer->getInstalledPackages();
     $required = $this->composer->getRequiredPackages();
     $outdated = [];
     // Get the installed version number of the required packages.
     $packages = array_intersect_key($installed, $required);
     foreach ($packages as $package) {
         $name = $package['name'];
         $version = Version::normalize($package['version']);
         $prettyVersion = $required[$name]['version'];
         $devDependency = $package['devDependency'];
         if (in_array($name, $excluded)) {
             continue;
         }
         $package = new Package($name, $version, $prettyVersion, $devDependency);
         if ($package->isOutdated()) {
             $outdated[] = $package;
         }
     }
     return $outdated;
 }
开发者ID:vinkla,项目名称:climb,代码行数:30,代码来源:Ladder.php

示例4: normalize

 /**
  * Normalizes a version string to the number of components given in the
  * parameter $precision.
  *
  * A single digit release version and a single digit major version are
  * contracted to a two digit release version. If no major version is given,
  * it is substituted by zero.
  *
  * Examples:
  *
  *     IcuVersion::normalize('1.2.3.4');
  *     // => '12.3.4'
  *
  *     IcuVersion::normalize('1.2.3.4', 1);
  *     // => '12'
  *
  *     IcuVersion::normalize('1.2.3.4', 2);
  *     // => '12.3'
  *
  * @param string   $version   An ICU version string
  * @param int|null $precision The number of components to include. Pass
  *                            NULL to return the version unchanged.
  *
  * @return string|null The normalized ICU version or NULL if it couldn't be
  *                     normalized.
  */
 public static function normalize($version, $precision)
 {
     $version = preg_replace('/^(\\d)\\.(\\d)/', '$1$2', $version);
     if (1 === strlen($version)) {
         $version .= '0';
     }
     return Version::normalize($version, $precision);
 }
开发者ID:ayoah,项目名称:symfony,代码行数:34,代码来源:IcuVersion.php


注:本文中的Version::normalize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。