mediatekformation

Ip extends Constraint
in package

Validates that a value is a valid IP address.

Tags
Annotation
Target

({"PROPERTY", "METHOD", "ANNOTATION"})

author

Bernhard Schussek bschussek@gmail.com

author

Joseph Bielawski stloyd@gmail.com

Table of Contents

ALL  = 'all'
ALL_NO_PRIV  = 'all_no_priv'
ALL_NO_RES  = 'all_no_res'
ALL_ONLY_PUBLIC  = 'all_public'
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_IP_ERROR  = 'b1b427ae-9f6f-41b0-aa9b-84511fbb3c5b'
PROPERTY_CONSTRAINT  = 'property'
Marks a constraint that can be put onto properties.
V4  = '4'
V4_NO_PRIV  = '4_no_priv'
V4_NO_RES  = '4_no_res'
V4_ONLY_PUBLIC  = '4_public'
V6  = '6'
V6_NO_PRIV  = '6_no_priv'
V6_NO_RES  = '6_no_res'
V6_ONLY_PUBLIC  = '6_public'
$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.
$version  : mixed
$errorNames  : mixed
Maps error codes to the names of their constants.
$versions  : mixed
__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

ALL

public mixed ALL = 'all'

ALL_NO_PRIV

public mixed ALL_NO_PRIV = 'all_no_priv'

ALL_NO_RES

public mixed ALL_NO_RES = 'all_no_res'

ALL_ONLY_PUBLIC

public mixed ALL_ONLY_PUBLIC = 'all_public'

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_IP_ERROR

public mixed INVALID_IP_ERROR = 'b1b427ae-9f6f-41b0-aa9b-84511fbb3c5b'

PROPERTY_CONSTRAINT

Marks a constraint that can be put onto properties.

public mixed PROPERTY_CONSTRAINT = 'property'

V4

public mixed V4 = '4'

V4_NO_PRIV

public mixed V4_NO_PRIV = '4_no_priv'

V4_NO_RES

public mixed V4_NO_RES = '4_no_res'

V4_ONLY_PUBLIC

public mixed V4_ONLY_PUBLIC = '4_public'

V6

public mixed V6 = '6'

V6_NO_PRIV

public mixed V6_NO_PRIV = '6_no_priv'

V6_NO_RES

public mixed V6_NO_RES = '6_no_res'

V6_ONLY_PUBLIC

public mixed V6_ONLY_PUBLIC = '6_public'

Properties

$groups

The groups that the constraint belongs to.

public array<string|int, string> $groups

$message

public mixed $message = 'This is not a valid IP address.'

$normalizer

public mixed $normalizer

$payload

Domain-specific data attached to a constraint.

public mixed $payload

$version

public mixed $version = self::V4

$errorNames

Maps error codes to the names of their constants.

protected static mixed $errorNames = [self::INVALID_IP_ERROR => 'INVALID_IP_ERROR']

$versions

protected static mixed $versions = [self::V4, self::V6, self::ALL, self::V4_NO_PRIV, self::V6_NO_PRIV, self::ALL_NO_PRIV, self::V4_NO_RES, self::V6_NO_RES, self::ALL_NO_RES, self::V4_ONLY_PUBLIC, self::V6_ONLY_PUBLIC, self::ALL_ONLY_PUBLIC]

Methods

__construct()

Initializes the constraint with options.

public __construct([mixed $options = null ]) : mixed
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
throws
InvalidOptionsException

If an invalid option name is given

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
see
__construct()
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
throws
InvalidArgumentException

If the error code does not exist

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
see
__construct()
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.

Return values
string —

Search results