class Validator
Same name in this branch
- 11.1.x vendor/phpunit/phpunit/src/TextUI/Configuration/Xml/Validator/Validator.php \PHPUnit\TextUI\XmlConfiguration\Validator
- 11.1.x vendor/justinrainbow/json-schema/src/JsonSchema/Validator.php \JsonSchema\Validator
Rfc4122\Validator validates strings as UUIDs of the RFC 4122 variant
@psalm-immutable
Hierarchy
- class \Ramsey\Uuid\Rfc4122\Validator implements \Ramsey\Uuid\Validator\ValidatorInterface
Expanded class hierarchy of Validator
6 string references to 'Validator'
- ArgumentPluginBase::buildOptionsForm in core/
modules/ views/ src/ Plugin/ views/ argument/ ArgumentPluginBase.php - Provide a form to edit options for this plugin.
- Constraint::validatedBy in vendor/
symfony/ validator/ Constraint.php - Returns the name of the class that validates this constraint.
- ExpressionSyntax::validatedBy in vendor/
symfony/ validator/ Constraints/ ExpressionSyntax.php - Returns the name of the class that validates this constraint.
- ValidatorDataCollector::getName in vendor/
symfony/ validator/ DataCollector/ ValidatorDataCollector.php - Returns the name of the collector.
- views.data_types.schema.yml in core/
modules/ views/ config/ schema/ views.data_types.schema.yml - core/modules/views/config/schema/views.data_types.schema.yml
File
-
vendor/
ramsey/ uuid/ src/ Rfc4122/ Validator.php, line 28
Namespace
Ramsey\Uuid\Rfc4122View source
final class Validator implements ValidatorInterface {
private const VALID_PATTERN = '\\A[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-' . '[1-8][0-9A-Fa-f]{3}-[ABab89][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}\\z';
/**
* @psalm-return non-empty-string
* @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty
* @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty
*/
public function getPattern() : string {
return self::VALID_PATTERN;
}
public function validate(string $uuid) : bool {
$uuid = str_replace([
'urn:',
'uuid:',
'URN:',
'UUID:',
'{',
'}',
], '', $uuid);
$uuid = strtolower($uuid);
return $uuid === Uuid::NIL || $uuid === Uuid::MAX || preg_match('/' . self::VALID_PATTERN . '/Dms', $uuid);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
Validator::getPattern | public | function | @psalm-return non-empty-string @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty |
Overrides ValidatorInterface::getPattern |
Validator::validate | public | function | Returns true if the provided string represents a UUID | Overrides ValidatorInterface::validate |
Validator::VALID_PATTERN | private | constant |