A generic bag containing properties and their values.

 Methods

Exports the {@link PropertyValueBag} to an array.

getArrayCopy() : array

Returns

array

Get an associative array of properties and their errors, whose values are invalid.

getInvalidPropertyErrors() : array

Returns

array

Get a list of all property names, whose values are invalid.

getInvalidPropertyNames() : string[]

Returns

string[]

Return the value of a property.

getPropertyValue(string $property) : mixed

Parameters

$property

string

The name of the property to check.

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralInvalidArgumentException If the property is not contained within the bag.

Returns

mixed

Return all errors of an invalid property value.

getPropertyValueErrors(string $property) : array

Parameters

$property

string

The name of the property to retrieve the errors for.

Returns

array

Check if this bag contains invalid property values.

hasInvalidPropertyValues() : bool

Returns

bool

Check if this bag contains no invalid property values.

hasNoInvalidPropertyValues() : bool

Returns

bool

Check if a property exists in this bag.

hasPropertyValue(string $property) : bool

Parameters

$property

string

The name of the property to check.

Returns

bool

Check if a property value is invalid.

isPropertyValueInvalid(string $property) : bool

Parameters

$property

string

The name of the property to check.

Returns

bool

Check if a property value is valid.

isPropertyValueValid(string $property) : bool

Parameters

$property

string

The name of the property to check.

Returns

bool

Mark a property as invalid and add an error message to the property.

markPropertyValueAsInvalid(string $property, string|array|mixed $error, bool $append) : \ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBag

Parameters

$property

string

The name of the property to mark.

$error

stringarraymixed

The error message to attach for this property.

$append

bool

Append this error and keep previous errors (optional).

Returns

Remove the value of a property.

removePropertyValue(string $property) : \ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBag

Parameters

$property

string

The name of the property to remove.

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralInvalidArgumentException If the property is not contained within the bag.

Returns

Reset the state of a property and remove all errors.

resetPropertyValueErrors(string $property) : \ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBag

Parameters

$property

string

The name of the property to reset.

Returns

Set the value of a property.

setPropertyValue(string $property, mixed $value) : \ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBag

Parameters

$property

string

The name of the property to set.

$value

mixed

The value to use.

Returns