mediatekformation

File extends Constraint
in package

Contains the properties of a constraint definition.

Tags
Annotation
Target

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

author

Bernhard Schussek bschussek@gmail.com

Table of Contents

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.
EMPTY_ERROR  = '5d743385-9775-4aa5-8ff5-495fb1e60137'
INVALID_MIME_TYPE_ERROR  = '744f00bc-4389-4c74-92de-9a43cde55534'
NOT_FOUND_ERROR  = 'd2a3fb6e-7ddc-4210-8fbf-2ab345ce1998'
NOT_READABLE_ERROR  = 'c20c92a4-5bfa-4202-9477-28e800e0f6ff'
PROPERTY_CONSTRAINT  = 'property'
Marks a constraint that can be put onto properties.
TOO_LARGE_ERROR  = 'df8637af-d466-48c6-a59d-e7126250a654'
$binaryFormat  : mixed
$disallowEmptyMessage  : mixed
$groups  : array<string|int, string>
The groups that the constraint belongs to.
$maxSize  : int
$maxSizeMessage  : mixed
$mimeTypes  : mixed
$mimeTypesMessage  : mixed
$notFoundMessage  : mixed
$notReadableMessage  : mixed
$payload  : mixed
Domain-specific data attached to a constraint.
$uploadCantWriteErrorMessage  : mixed
$uploadErrorMessage  : mixed
$uploadExtensionErrorMessage  : mixed
$uploadFormSizeErrorMessage  : mixed
$uploadIniSizeErrorMessage  : mixed
$uploadNoFileErrorMessage  : mixed
$uploadNoTmpDirErrorMessage  : mixed
$uploadPartialErrorMessage  : mixed
$errorNames  : mixed
Maps error codes to the names of their constants.
$maxSize  : mixed
__construct()  : mixed
Initializes the constraint with options.
__get()  : mixed
__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.
normalizeBinaryFormat()  : mixed

Constants

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'

EMPTY_ERROR

public mixed EMPTY_ERROR = '5d743385-9775-4aa5-8ff5-495fb1e60137'

INVALID_MIME_TYPE_ERROR

public mixed INVALID_MIME_TYPE_ERROR = '744f00bc-4389-4c74-92de-9a43cde55534'

NOT_FOUND_ERROR

public mixed NOT_FOUND_ERROR = 'd2a3fb6e-7ddc-4210-8fbf-2ab345ce1998'

NOT_READABLE_ERROR

public mixed NOT_READABLE_ERROR = 'c20c92a4-5bfa-4202-9477-28e800e0f6ff'

PROPERTY_CONSTRAINT

Marks a constraint that can be put onto properties.

public mixed PROPERTY_CONSTRAINT = 'property'

TOO_LARGE_ERROR

public mixed TOO_LARGE_ERROR = 'df8637af-d466-48c6-a59d-e7126250a654'

Properties

$binaryFormat

public mixed $binaryFormat

$disallowEmptyMessage

public mixed $disallowEmptyMessage = 'An empty file is not allowed.'

$groups

The groups that the constraint belongs to.

public array<string|int, string> $groups

$maxSize

public int $maxSize

$maxSizeMessage

public mixed $maxSizeMessage = 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.'

$mimeTypes

public mixed $mimeTypes = []

$mimeTypesMessage

public mixed $mimeTypesMessage = 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.'

$notFoundMessage

public mixed $notFoundMessage = 'The file could not be found.'

$notReadableMessage

public mixed $notReadableMessage = 'The file is not readable.'

$payload

Domain-specific data attached to a constraint.

public mixed $payload

$uploadCantWriteErrorMessage

public mixed $uploadCantWriteErrorMessage = 'Cannot write temporary file to disk.'

$uploadErrorMessage

public mixed $uploadErrorMessage = 'The file could not be uploaded.'

$uploadExtensionErrorMessage

public mixed $uploadExtensionErrorMessage = 'A PHP extension caused the upload to fail.'

$uploadFormSizeErrorMessage

public mixed $uploadFormSizeErrorMessage = 'The file is too large.'

$uploadIniSizeErrorMessage

public mixed $uploadIniSizeErrorMessage = 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.'

$uploadNoFileErrorMessage

public mixed $uploadNoFileErrorMessage = 'No file was uploaded.'

$uploadNoTmpDirErrorMessage

public mixed $uploadNoTmpDirErrorMessage = 'No temporary folder was configured in php.ini.'

$uploadPartialErrorMessage

public mixed $uploadPartialErrorMessage = 'The file was only partially uploaded.'

$errorNames

Maps error codes to the names of their constants.

protected static mixed $errorNames = [self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR', self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR', self::EMPTY_ERROR => 'EMPTY_ERROR', self::TOO_LARGE_ERROR => 'TOO_LARGE_ERROR', self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR']

$maxSize

protected mixed $maxSize

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 —

__get()

public __get(mixed $option) : mixed
Parameters
$option : mixed
Return values
mixed —

__isset()

public __isset(mixed $option) : bool
Parameters
$option : mixed

The option name

Return values
bool —

__set()

Sets the value of a lazily initialized option.

public __set(mixed $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 : mixed

The option name

$value : mixed

The value to set

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 —

normalizeBinaryFormat()

private normalizeBinaryFormat(mixed $maxSize) : mixed
Parameters
$maxSize : mixed
Return values
mixed —

Search results