本文整理汇总了PHP中PEAR_Dependency2::signOperator方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Dependency2::signOperator方法的具体用法?PHP PEAR_Dependency2::signOperator怎么用?PHP PEAR_Dependency2::signOperator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_Dependency2
的用法示例。
在下文中一共展示了PEAR_Dependency2::signOperator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: normalizeDep
/**
* Convert a 1.0 dep into a 2.0 dep
*/
function normalizeDep($dep)
{
$types = array('pkg' => 'Package', 'ext' => 'Extension', 'os' => 'Os', 'php' => 'Php');
if (!isset($types[$dep['type']])) {
return array(false, false);
}
$type = $types[$dep['type']];
$newdep = array();
switch ($type) {
case 'Package':
$newdep['channel'] = 'pear.php.net';
case 'Extension':
case 'Os':
$newdep['name'] = $dep['name'];
break;
}
$dep['rel'] = PEAR_Dependency2::signOperator($dep['rel']);
switch ($dep['rel']) {
case 'has':
return array($newdep, $type);
break;
case 'not':
$newdep['conflicts'] = true;
break;
case '>=':
case '>':
$newdep['min'] = $dep['version'];
if ($dep['rel'] == '>') {
$newdep['exclude'] = $dep['version'];
}
break;
case '<=':
case '<':
$newdep['max'] = $dep['version'];
if ($dep['rel'] == '<') {
$newdep['exclude'] = $dep['version'];
}
break;
case 'ne':
case '!=':
$newdep['min'] = '0';
$newdep['max'] = '100000';
$newdep['exclude'] = $dep['version'];
break;
case '==':
$newdep['min'] = $dep['version'];
$newdep['max'] = $dep['version'];
break;
}
if ($type == 'Php') {
if (!isset($newdep['min'])) {
$newdep['min'] = '4.4.0';
}
if (!isset($newdep['max'])) {
$newdep['max'] = '6.0.0';
}
}
return array($newdep, $type);
}