Url
extends Constraint
in package
Contains the properties of a constraint definition.
Tags
Table of Contents
- CHECK_DNS_TYPE_A = 'A'
- CHECK_DNS_TYPE_A6 = 'A6'
- CHECK_DNS_TYPE_AAAA = 'AAAA'
- CHECK_DNS_TYPE_ANY = 'ANY'
- CHECK_DNS_TYPE_CNAME = 'CNAME'
- CHECK_DNS_TYPE_MX = 'MX'
- CHECK_DNS_TYPE_NAPTR = 'NAPTR'
- CHECK_DNS_TYPE_NONE = false
- CHECK_DNS_TYPE_NS = 'NS'
- CHECK_DNS_TYPE_PTR = 'PTR'
- CHECK_DNS_TYPE_SOA = 'SOA'
- CHECK_DNS_TYPE_SRV = 'SRV'
- CHECK_DNS_TYPE_TXT = 'TXT'
- CLASS_CONSTRAINT = 'class'
- Marks a constraint that can be put onto classes.
- DEFAULT_GROUP = 'Default'
- The name of the group given to all constraints with no explicit group.
- INVALID_URL_ERROR = '57c2f299-1154-4870-89bb-ef3b1f5ad229'
- PROPERTY_CONSTRAINT = 'property'
- Marks a constraint that can be put onto properties.
- $checkDNS : mixed
- $dnsMessage : mixed
- $groups : array<string|int, string>
- The groups that the constraint belongs to.
- $message : mixed
- $normalizer : mixed
- $payload : mixed
- Domain-specific data attached to a constraint.
- $protocols : mixed
- $relativeProtocol : mixed
- $errorNames : mixed
- Maps error codes to the names of their constants.
- __construct() : mixed
- Initializes the constraint with options.
- __isset() : bool
- __set() : mixed
- Sets the value of a lazily initialized option.
- addImplicitGroupName() : mixed
- Adds the given group if this constraint is in the Default group.
- getDefaultOption() : string|null
- Returns the name of the default option.
- getErrorName() : string
- Returns the name of the given error code.
- getRequiredOptions() : array<string|int, string>
- Returns the name of the required options.
- getTargets() : string|array<string|int, string>
- Returns whether the constraint can be put onto classes, properties or both.
- validatedBy() : string
- Returns the name of the class that validates this constraint.
Constants
CHECK_DNS_TYPE_A
public
mixed
CHECK_DNS_TYPE_A
= 'A'
Tags
CHECK_DNS_TYPE_A6
public
mixed
CHECK_DNS_TYPE_A6
= 'A6'
Tags
CHECK_DNS_TYPE_AAAA
public
mixed
CHECK_DNS_TYPE_AAAA
= 'AAAA'
Tags
CHECK_DNS_TYPE_ANY
public
mixed
CHECK_DNS_TYPE_ANY
= 'ANY'
Tags
CHECK_DNS_TYPE_CNAME
public
mixed
CHECK_DNS_TYPE_CNAME
= 'CNAME'
Tags
CHECK_DNS_TYPE_MX
public
mixed
CHECK_DNS_TYPE_MX
= 'MX'
Tags
CHECK_DNS_TYPE_NAPTR
public
mixed
CHECK_DNS_TYPE_NAPTR
= 'NAPTR'
Tags
CHECK_DNS_TYPE_NONE
public
mixed
CHECK_DNS_TYPE_NONE
= false
Tags
CHECK_DNS_TYPE_NS
public
mixed
CHECK_DNS_TYPE_NS
= 'NS'
Tags
CHECK_DNS_TYPE_PTR
public
mixed
CHECK_DNS_TYPE_PTR
= 'PTR'
Tags
CHECK_DNS_TYPE_SOA
public
mixed
CHECK_DNS_TYPE_SOA
= 'SOA'
Tags
CHECK_DNS_TYPE_SRV
public
mixed
CHECK_DNS_TYPE_SRV
= 'SRV'
Tags
CHECK_DNS_TYPE_TXT
public
mixed
CHECK_DNS_TYPE_TXT
= 'TXT'
Tags
CLASS_CONSTRAINT
Marks a constraint that can be put onto classes.
public
mixed
CLASS_CONSTRAINT
= 'class'
DEFAULT_GROUP
The name of the group given to all constraints with no explicit group.
public
mixed
DEFAULT_GROUP
= 'Default'
INVALID_URL_ERROR
public
mixed
INVALID_URL_ERROR
= '57c2f299-1154-4870-89bb-ef3b1f5ad229'
PROPERTY_CONSTRAINT
Marks a constraint that can be put onto properties.
public
mixed
PROPERTY_CONSTRAINT
= 'property'
Properties
$checkDNS
public
mixed
$checkDNS
= self::CHECK_DNS_TYPE_NONE
Tags
$dnsMessage
public
mixed
$dnsMessage
= 'The host could not be resolved.'
Tags
$groups
The groups that the constraint belongs to.
public
array<string|int, string>
$groups
$message
public
mixed
$message
= 'This value is not a valid URL.'
$normalizer
public
mixed
$normalizer
$payload
Domain-specific data attached to a constraint.
public
mixed
$payload
$protocols
public
mixed
$protocols
= ['http', 'https']
$relativeProtocol
public
mixed
$relativeProtocol
= false
$errorNames
Maps error codes to the names of their constants.
protected
static mixed
$errorNames
= [self::INVALID_URL_ERROR => 'INVALID_URL_ERROR']
Methods
__construct()
Initializes the constraint with options.
public
__construct([mixed $options = null ]) : mixed
You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties.
Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead.
You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown.
Parameters
- $options : mixed = null
-
The options (as associative array) or the value for the default option (any other type)
Return values
mixed —__isset()
public
__isset(string $option) : bool
Parameters
- $option : string
-
The option name
Return values
bool —__set()
Sets the value of a lazily initialized option.
public
__set(string $option, mixed $value) : mixed
Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name.
Parameters
- $option : string
-
The option name
- $value : mixed
-
The value to set
Tags
Return values
mixed —addImplicitGroupName()
Adds the given group if this constraint is in the Default group.
public
addImplicitGroupName(string $group) : mixed
Parameters
- $group : string
Return values
mixed —getDefaultOption()
Returns the name of the default option.
public
getDefaultOption() : string|null
Override this method to define a default option.
Tags
Return values
string|null —getErrorName()
Returns the name of the given error code.
public
static getErrorName(string $errorCode) : string
Parameters
- $errorCode : string
-
The error code
Tags
Return values
string —The name of the error code
getRequiredOptions()
Returns the name of the required options.
public
getRequiredOptions() : array<string|int, string>
Override this method if you want to define required options.
Tags
Return values
array<string|int, string> —getTargets()
Returns whether the constraint can be put onto classes, properties or both.
public
getTargets() : string|array<string|int, string>
This method should return one or more of the constants Constraint::CLASS_CONSTRAINT and Constraint::PROPERTY_CONSTRAINT.
Return values
string|array<string|int, string> —One or more constant values
validatedBy()
Returns the name of the class that validates this constraint.
public
validatedBy() : string
By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behavior.