本文整理汇总了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();
}
}