當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。