|
Perforce Chronicle 2012.2/486814
API Documentation
|
Validates string for suitability as a Perforce stream name. More...
Public Member Functions | |
| __construct () | |
| Revised message templates upon instantiation. | |
| isValid ($value) | |
| Checks if the given string is a valid perforce spec name. | |
Public Attributes | |
| const | INVALID_FORMAT = 'format' |
Protected Attributes | |
| $_allowCommas = false | |
| $_allowPercent = false | |
| $_allowPositional = true | |
| $_allowRelative = false | |
| $_allowSlashes = true | |
Validates string for suitability as a Perforce stream name.
Extends spec-name to verify we lead with two slashes and contain a third. Also toggles some default settings to match p4ds validation.
| P4_Validate_StreamName::__construct | ( | ) |
Revised message templates upon instantiation.
{
$message = "Value is not the correct format of '//depotname/string'";
$this->_messageTemplates[self::INVALID_FORMAT] = $message;
}
| P4_Validate_StreamName::isValid | ( | $ | value | ) |
Checks if the given string is a valid perforce spec name.
| string | int | $value | spec name value to validate. |
Reimplemented from P4_Validate_KeyName.
{
if (!parent::isValid($value)) {
return false;
}
// verify stream is in the format //depotname/string
if (!preg_match('#^//[^/]+/[^/]+$#', $value)) {
$this->_error(static::INVALID_FORMAT);
return false;
}
return true;
}
P4_Validate_StreamName::$_allowCommas = false [protected] |
Reimplemented from P4_Validate_KeyName.
P4_Validate_StreamName::$_allowPercent = false [protected] |
Reimplemented from P4_Validate_KeyName.
P4_Validate_StreamName::$_allowPositional = true [protected] |
Reimplemented from P4_Validate_KeyName.
P4_Validate_StreamName::$_allowRelative = false [protected] |
Reimplemented from P4_Validate_KeyName.
P4_Validate_StreamName::$_allowSlashes = true [protected] |
Reimplemented from P4_Validate_KeyName.
| const P4_Validate_StreamName::INVALID_FORMAT = 'format' |