Dto
extends Base
in package
DTO Class handles compound objects with named properties.
Table of Contents
Properties
- $errors : array<string|int, mixed>
- $name : string
- $parent : ICompound|null
- $properties : array<string|int, mixed>
Methods
- __construct() : mixed
- Dto constructor.
- __get() : mixed
- Magic method for accessing parameters via dto->parameter
- __set() : void
- Magic method for setting parameter values via dto->parameter = value.
- __toString() : string
- addErrors() : ICompound
- Adds a validation error to the list.
- clearErrors() : void
- Resets the error list.
- getAsJson() : string
- getErrors() : array<string|int, mixed>
- Returns a list of validation errors for all parameter values.
- getName() : string
- getParent() : ICompound|null
- getProperties() : array<string|int, mixed>
- Gets a list of all validation errors.
- getProperty() : Property|null
- Gets a parameter by name.
- setName() : ICompound
- setParent() : ICompound
- setProperty() : $this
- Sets a parameter by name.
- validate() : bool
- Validates the values for all parameters.
- validateArray() : void
- validateDto() : void
- validateProperty() : void
- validateScalar() : void
Properties
$errors
private
array<string|int, mixed>
$errors
= []
$name
private
string
$name
$parent
private
ICompound|null
$parent
= null
$properties
private
array<string|int, mixed>
$properties
= []
Methods
__construct()
Dto constructor.
public
__construct() : mixed
__get()
Magic method for accessing parameters via dto->parameter
public
__get(string $name) : mixed
Parameters
- $name : string
Tags
__set()
Magic method for setting parameter values via dto->parameter = value.
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
Tags
__toString()
public
__toString() : string
Return values
stringaddErrors()
Adds a validation error to the list.
public
addErrors(array<string|int, mixed> $errors) : ICompound
Parameters
- $errors : array<string|int, mixed>
Return values
ICompoundclearErrors()
Resets the error list.
public
clearErrors() : void
getAsJson()
public
getAsJson() : string
Return values
stringgetErrors()
Returns a list of validation errors for all parameter values.
public
getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed>getName()
public
getName() : string
Return values
stringgetParent()
public
getParent() : ICompound|null
Return values
ICompound|nullgetProperties()
Gets a list of all validation errors.
public
getProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>getProperty()
Gets a parameter by name.
public
getProperty(string $name) : Property|null
Parameters
- $name : string
Return values
Property|nullsetName()
public
setName(string $name) : ICompound
Parameters
- $name : string
Return values
ICompoundsetParent()
public
setParent(Dto|null $parent) : ICompound
Parameters
- $parent : Dto|null
Return values
ICompoundsetProperty()
Sets a parameter by name.
public
setProperty(string $name, Property $parameter) : $this
Parameters
- $name : string
- $parameter : Property
Return values
$thisvalidate()
Validates the values for all parameters.
public
validate() : bool
Tags
Return values
bool —Returns true if validation passes, false otherwise
validateArray()
protected
validateArray(Property $property) : void
Parameters
- $property : Property
Tags
validateDto()
protected
validateDto(Dto $dto) : void
Parameters
- $dto : Dto
Tags
validateProperty()
protected
validateProperty(mixed $property) : void
Parameters
- $property : mixed
Tags
validateScalar()
protected
validateScalar(mixed $property) : void
Parameters
- $property : mixed