Neuron-PHP

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

$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
throws
PropertyNotFound

__set()

Magic method for setting parameter values via dto->parameter = value.

public __set(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed
Tags
throws
Validation
throws
PropertyNotFound

__toString()

public __toString() : string
Return values
string

addErrors()

Adds a validation error to the list.

public addErrors(array<string|int, mixed> $errors) : ICompound
Parameters
$errors : array<string|int, mixed>
Return values
ICompound

clearErrors()

Resets the error list.

public clearErrors() : void

getAsJson()

public getAsJson() : string
Return values
string

getErrors()

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
string

getProperties()

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|null

setProperty()

Sets a parameter by name.

public setProperty(string $name, Property $parameter) : $this
Parameters
$name : string
$parameter : Property
Return values
$this

validate()

Validates the values for all parameters.

public validate() : bool
Tags
throws
Validation
Return values
bool

Returns true if validation passes, false otherwise

validateProperty()

protected validateProperty(mixed $property) : void
Parameters
$property : mixed
Tags
throws
Validation

validateScalar()

protected validateScalar(mixed $property) : void
Parameters
$property : mixed

        
On this page

Search results