本文整理汇总了PHP中PEAR_PackageFile_v2::getPackagexmlVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFile_v2::getPackagexmlVersion方法的具体用法?PHP PEAR_PackageFile_v2::getPackagexmlVersion怎么用?PHP PEAR_PackageFile_v2::getPackagexmlVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_PackageFile_v2
的用法示例。
在下文中一共展示了PEAR_PackageFile_v2::getPackagexmlVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validatePackageName
/**
* @access protected
*/
function validatePackageName()
{
if ($this->_state == PEAR_VALIDATE_PACKAGING || $this->_state == PEAR_VALIDATE_NORMAL) {
if (($this->_packagexml->getPackagexmlVersion() == '2.0' || $this->_packagexml->getPackagexmlVersion() == '2.1') && $this->_packagexml->getExtends()) {
$version = $this->_packagexml->getVersion() . '';
$name = $this->_packagexml->getPackage();
$test = array_shift($a = explode('.', $version));
if ($test == '0') {
return true;
}
$vlen = strlen($test);
$majver = substr($name, strlen($name) - $vlen);
while ($majver && !is_numeric($majver[0])) {
$majver = substr($majver, 1);
}
if ($majver != $test) {
$this->_addWarning('package', "package {$name} extends package " . $this->_packagexml->getExtends() . ' and so the name should ' . 'have a postfix equal to the major version like "' . $this->_packagexml->getExtends() . $test . '"');
return true;
} elseif (substr($name, 0, strlen($name) - $vlen) != $this->_packagexml->getExtends()) {
$this->_addWarning('package', "package {$name} extends package " . $this->_packagexml->getExtends() . ' and so the name must ' . 'be an extension like "' . $this->_packagexml->getExtends() . $test . '"');
return true;
}
}
}
if (!$this->validPackageName($this->_packagexml->getPackage())) {
$this->_addFailure('name', 'package name "' . $this->_packagexml->getPackage() . '" is invalid');
return false;
}
}