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