cvs: pear-core /PEAR Validate.php
| From: | Greg Beaver | Date: | Wed, 03 Nov 2004 22:58:13 +0000 |
| Subject: | cvs: pear-core /PEAR Validate.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-1223@lists.php.net to get a copy of this message | ||
cellog Wed Nov 3 17:58:13 2004 EDT
Modified files:
/pear-core/PEAR Validate.php
Log:
add docs, make validState()/getValidStates() actually
work as documented (static, final)
http://cvs.php.net/diff.php/pear-core/PEAR/Validate.php?r1=1.22&r2=1.23&ty=u
Index: pear-core/PEAR/Validate.php
diff -u pear-core/PEAR/Validate.php:1.22 pear-core/PEAR/Validate.php:1.23
--- pear-core/PEAR/Validate.php:1.22 Wed Nov 3 17:49:06 2004
+++ pear-core/PEAR/Validate.php Wed Nov 3 17:58:12 2004
@@ -16,7 +16,7 @@
// | Authors: Gregory Beaver <cellog@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Validate.php,v 1.22 2004/11/03 22:49:06 cellog Exp $
+// $Id: Validate.php,v 1.23 2004/11/03 22:58:12 cellog Exp $
define('PEAR_VALIDATE_INSTALLING', 1);
define('PEAR_VALIDATE_UNINSTALLING', 2); // this is not bit-mapped like the others
define('PEAR_VALIDATE_NORMAL', 3);
@@ -34,12 +34,6 @@
* @var int one of the PEAR_VALIDATE_* constants
*/
var $_state = PEAR_VALIDATE_NORMAL;
- /**
- * Valid release states
- * @var array
- * @access private
- */
- var $_validStates = array('alpha', 'beta', 'stable',
'snapshot', 'devel');
/**
* Format: ('error' => array('field' => name, 'reason'
=> reason), 'warning' => same)
* @var array
@@ -85,21 +79,45 @@
return (bool) preg_match('/^' . _PEAR_COMMON_PACKAGE_NAME_PREG . '$/',
$name);
}
+ /**
+ * Determine whether $state represents a valid stability level
+ * @param string
+ * @return bool
+ * @static
+ * @final
+ */
function validState($state)
{
- return in_array($state, $this->_validStates);
+ return in_array($state, array('alpha', 'beta', 'stable',
'snapshot', 'devel'));
}
+ /**
+ * Get a list of valid stability levels
+ * @return array
+ * @static
+ * @final
+ */
function getValidStates()
{
- return $this->_validStates;
+ return array('alpha', 'beta', 'stable', 'snapshot',
'devel');
}
+ /**
+ * Determine whether a version is a properly formatted version number that can be used
+ * by version_compare
+ * @param string
+ * @return bool
+ * @static
+ * @final
+ */
function validVersion($ver)
{
return (bool) preg_match(PEAR_COMMON_PACKAGE_VERSION_PREG, $ver);
}
+ /**
+ * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
+ */
function setPackageFile(&$pf)
{
$this->_packagexml = &$pf;