當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PEAR_Dependency2::normalizeDep方法代碼示例

本文整理匯總了PHP中PEAR_Dependency2::normalizeDep方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR_Dependency2::normalizeDep方法的具體用法?PHP PEAR_Dependency2::normalizeDep怎麽用?PHP PEAR_Dependency2::normalizeDep使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PEAR_Dependency2的用法示例。


在下文中一共展示了PEAR_Dependency2::normalizeDep方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isEqual

 /**
  * @param array Parsed array from {@link PEAR_Registry::parsePackageName()} or a dependency
  *                     returned from getDepDownloadURL()
  */
 function isEqual($param)
 {
     if (is_object($param)) {
         $channel = $param->getChannel();
         $package = $param->getPackage();
         if ($param->getURI()) {
             $param = array('channel' => $param->getChannel(), 'package' => $param->getPackage(), 'version' => $param->getVersion(), 'uri' => $param->getURI());
         } else {
             $param = array('channel' => $param->getChannel(), 'package' => $param->getPackage(), 'version' => $param->getVersion());
         }
     } else {
         if (isset($param['uri'])) {
             $param['channel'] = '__uri';
             $param['package'] = $param['dep']['name'];
         }
         $package = isset($param['package']) ? $param['package'] : $param['info']->getPackage();
         $channel = isset($param['channel']) ? $param['channel'] : $param['info']->getChannel();
         if (isset($param['rel'])) {
             if (!class_exists('PEAR_Dependency2')) {
                 require_once 'PEAR/Dependency2.php';
             }
             $newdep = PEAR_Dependency2::normalizeDep($param);
             $newdep = $newdep[0];
         } elseif (isset($param['min'])) {
             $newdep = $param;
         }
     }
     if (isset($newdep)) {
         if (!isset($newdep['min'])) {
             $newdep['min'] = '0';
         }
         if (!isset($newdep['max'])) {
             $newdep['max'] = '100000000000000000000';
         }
         // use magic to support pecl packages suddenly jumping to the pecl channel
         // we need to support both dependency possibilities
         if ($channel == 'pear.php.net' && $this->getChannel() == 'pecl.php.net') {
             if ($package == $this->getPackage()) {
                 $channel = 'pecl.php.net';
             }
         }
         if ($channel == 'pecl.php.net' && $this->getChannel() == 'pear.php.net') {
             if ($package == $this->getPackage()) {
                 $channel = 'pear.php.net';
             }
         }
         return strtolower($package) == strtolower($this->getPackage()) && $channel == $this->getChannel() && version_compare($newdep['min'], $this->getVersion(), '<=') && version_compare($newdep['max'], $this->getVersion(), '>=');
     }
     // use magic to support pecl packages suddenly jumping to the pecl channel
     if ($channel == 'pecl.php.net' && $this->getChannel() == 'pear.php.net') {
         if (strtolower($package) == strtolower($this->getPackage())) {
             $channel = 'pear.php.net';
         }
     }
     if (isset($param['version'])) {
         return strtolower($package) == strtolower($this->getPackage()) && $channel == $this->getChannel() && $param['version'] == $this->getVersion();
     } else {
         return strtolower($package) == strtolower($this->getPackage()) && $channel == $this->getChannel();
     }
 }
開發者ID:hbustun,項目名稱:agilebill,代碼行數:64,代碼來源:Package.php


注:本文中的PEAR_Dependency2::normalizeDep方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。