interface ValidationInterface (View source)

Formatters may implement ValidationInterface in order to indicate whether a particular data structure is supported. Any formatter that does not implement ValidationInterface is assumed to only operate on arrays, or data types that implement SimplifyToArrayInterface.

Methods

isValidDataType(ReflectionClass $dataType)

Return true if the specified format is valid for use with this formatter.

mixed
validate(mixed $structuredData)

Throw an IncompatibleDataException if the provided data cannot be processed by this formatter. Return the source data if it is valid. The data may be encapsulated or converted if necessary.

Details

isValidDataType(ReflectionClass $dataType)

Return true if the specified format is valid for use with this formatter.

Parameters

ReflectionClass $dataType

mixed validate(mixed $structuredData)

Throw an IncompatibleDataException if the provided data cannot be processed by this formatter. Return the source data if it is valid. The data may be encapsulated or converted if necessary.

Parameters

mixed $structuredData

Data to validate

Return Value

mixed