Documentation

ArrayModel extends AbstractModel
in package

AbstractYes

Model for data consisting of properties identified with a key.

The model specifies the keys, and the model for each of its properties.

Table of Contents

Properties

$properties  : array<string|int, mixed>

Methods

__construct()  : mixed
addProperty()  : self
getNotNullConstraint()  : INotNullConstraint|null
getProperties()  : array<string, IModel>
This guarantees each property has a unique key in the context of the model.
isNullable()  : bool
Shorter way to check whether the content can be null.
prune()  : self
removeProperty()  : self

Properties

$properties

protected array<string|int, mixed> $properties

Methods

__construct()

public __construct(array<string, IModel$properties[, bool $isNullable = false ]) : mixed
Parameters
$properties : array<string, IModel>

An associative list of properties.

$isNullable : bool = false

Whether this model is nullable.

Tags
todo

Check that property keys are strings.

addProperty()

public abstract addProperty(string $key, IModel $model) : self
Parameters
$key : string
$model : IModel
Return values
self

getProperties()

This guarantees each property has a unique key in the context of the model.

public getProperties() : array<string, IModel>
Return values
array<string, IModel>

An associative array of properties.

isNullable()

Shorter way to check whether the content can be null.

public isNullable() : bool
Attributes
#[Override]
Return values
bool

prune()

public abstract prune(array<int, string> $propertiesToKeep) : self
Parameters
$propertiesToKeep : array<int, string>
Return values
self

removeProperty()

public abstract removeProperty(string $keyToRemove) : self
Parameters
$keyToRemove : string
Return values
self
On this page

Search results