本文整理匯總了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);
}