Subversion Repositories Applications.gtt

Rev

Rev 94 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
94 jpm 1
<?php
2
/**
3
 * Channel Validator for the pecl.php.net channel
4
 *
5
 * PHP 4 and PHP 5
6
 *
7
 * @category   pear
8
 * @package    PEAR
9
 * @author     Greg Beaver <cellog@php.net>
10
 * @copyright  1997-2006 The PHP Group
187 mathias 11
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
94 jpm 12
 * @link       http://pear.php.net/package/PEAR
13
 * @since      File available since Release 1.4.0a5
14
 */
15
/**
16
 * This is the parent class for all validators
17
 */
18
require_once 'PEAR/Validate.php';
19
/**
20
 * Channel Validator for the pecl.php.net channel
21
 * @category   pear
22
 * @package    PEAR
23
 * @author     Greg Beaver <cellog@php.net>
187 mathias 24
 * @copyright  1997-2009 The Authors
25
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
26
 * @version    Release: 1.10.1
94 jpm 27
 * @link       http://pear.php.net/package/PEAR
28
 * @since      Class available since Release 1.4.0a5
29
 */
30
class PEAR_Validator_PECL extends PEAR_Validate
31
{
32
    function validateVersion()
33
    {
34
        if ($this->_state == PEAR_VALIDATE_PACKAGING) {
35
            $version = $this->_packagexml->getVersion();
36
            $versioncomponents = explode('.', $version);
37
            $last = array_pop($versioncomponents);
38
            if (substr($last, 1, 2) == 'rc') {
39
                $this->_addFailure('version', 'Release Candidate versions must have ' .
40
                'upper-case RC, not lower-case rc');
41
                return false;
42
            }
43
        }
44
        return true;
45
    }
46
 
47
    function validatePackageName()
48
    {
49
        $ret = parent::validatePackageName();
50
        if ($this->_packagexml->getPackageType() == 'extsrc' ||
51
              $this->_packagexml->getPackageType() == 'zendextsrc') {
52
            if (strtolower($this->_packagexml->getPackage()) !=
53
                  strtolower($this->_packagexml->getProvidesExtension())) {
54
                $this->_addWarning('providesextension', 'package name "' .
55
                    $this->_packagexml->getPackage() . '" is different from extension name "' .
56
                    $this->_packagexml->getProvidesExtension() . '"');
57
            }
58
        }
59
        return $ret;
60
    }
61
}
62
?>