3 * Channel Validator for the pecl.php.net channel
9 * @author Greg Beaver <cellog@php.net>
10 * @copyright 1997-2006 The PHP Group
11 * @license http://opensource.org/licenses/bsd-license.php New BSD License
12 * @version CVS: $Id: PECL.php 313023 2011-07-06 19:17:11Z dufuz $
13 * @link http://pear.php.net/package/PEAR
14 * @since File available since Release 1.4.0a5
17 * This is the parent class for all validators
19 require_once 'PEAR/Validate.php';
21 * Channel Validator for the pecl.php.net channel
24 * @author Greg Beaver <cellog@php.net>
25 * @copyright 1997-2009 The Authors
26 * @license http://opensource.org/licenses/bsd-license.php New BSD License
27 * @version Release: 1.9.4
28 * @link http://pear.php.net/package/PEAR
29 * @since Class available since Release 1.4.0a5
31 class PEAR_Validator_PECL extends PEAR_Validate
33 function validateVersion()
35 if ($this->_state == PEAR_VALIDATE_PACKAGING) {
36 $version = $this->_packagexml->getVersion();
37 $versioncomponents = explode('.', $version);
38 $last = array_pop($versioncomponents);
39 if (substr($last, 1, 2) == 'rc') {
40 $this->_addFailure('version', 'Release Candidate versions must have ' .
41 'upper-case RC, not lower-case rc');
48 function validatePackageName()
50 $ret = parent::validatePackageName();
51 if ($this->_packagexml->getPackageType() == 'extsrc' ||
52 $this->_packagexml->getPackageType() == 'zendextsrc') {
53 if (strtolower($this->_packagexml->getPackage()) !=
54 strtolower($this->_packagexml->getProvidesExtension())) {
55 $this->_addWarning('providesextension', 'package name "' .
56 $this->_packagexml->getPackage() . '" is different from extension name "' .
57 $this->_packagexml->getProvidesExtension() . '"');