本文整理汇总了PHP中PEAR_Dependency2::validatePackageDependency方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Dependency2::validatePackageDependency方法的具体用法?PHP PEAR_Dependency2::validatePackageDependency怎么用?PHP PEAR_Dependency2::validatePackageDependency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_Dependency2
的用法示例。
在下文中一共展示了PEAR_Dependency2::validatePackageDependency方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validatePackageDependency
public function validatePackageDependency($dep, $required, $params, $depv1 = false)
{
if ('symfony' === strtolower($dep['name'])) {
return true;
}
if ('openpne' === strtolower($dep['name'])) {
$extra = $this->_getExtraString($dep);
if (isset($dep['min']) && !version_compare(OPENPNE_VERSION, $dep['min'], '>=')) {
return $this->handleOpenPNEDependencyError('%s requires OpenPNE' . $extra . ', installed version is ' . OPENPNE_VERSION);
}
if (isset($dep['max']) && !version_compare(OPENPNE_VERSION, $dep['max'], '<=')) {
return $this->handleOpenPNEDependencyError('%s requires OpenPNE' . $extra . ', installed version is ' . OPENPNE_VERSION);
}
if (isset($dep['exclude'])) {
foreach ((array) $dep['exclude'] as $exclude) {
if (version_compare(OPENPNE_VERSION, $exclude, '==')) {
return $this->handleOpenPNEDependencyError('%s is not compatible with OpenPNE version ' . $exclude);
}
}
}
return true;
}
$result = parent::validatePackageDependency($dep, $required, $params, $depv1);
if (PEAR::isError($result)) {
$dep['package'] = $dep['name'];
$this->failedDependency['package'][] = $dep;
}
return $result;
}
示例2: checkDependency
/**
* Checks that the dependency is valid.
*
* @param array $dependency A dependency array
*
* @return Boolean true if the dependency is valid, false otherwise
*/
protected function checkDependency($dependency)
{
$dependencyChecker = new PEAR_Dependency2($this->environment->getConfig(), array(), array('package' => '', 'channel' => ''));
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
$e = $dependencyChecker->validatePackageDependency($dependency, true, array());
PEAR::staticPopErrorHandling();
if (PEAR::isError($e)) {
return false;
}
return true;
}