当前位置: 首页>>代码示例>>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;未经允许,请勿转载。