NestedPropertyCollectionTrait
Nested Properties Collection Trait
Table of Contents
Methods
- defNestedProperty() : $this
- getNestedProperty() : array<string|int, mixed>
- group() : array<string|int, mixed>
- Group items in the collection by a field.
- hasNestedProperty() : array<string|int, mixed>
- setNestedProperty() : $this
- unsetNestedProperty() : $this
Methods
defNestedProperty()
public
defNestedProperty(string $property, string $default[, string|null $separator = null ]) : $this
Parameters
- $property : string
-
Object property to be updated.
- $default : string
-
Default value.
- $separator : string|null = null
-
Separator, defaults to '.'
Return values
$thisgetNestedProperty()
public
getNestedProperty(string $property[, mixed $default = null ][, string|null $separator = null ]) : array<string|int, mixed>
Parameters
- $property : string
-
Object property to be fetched.
- $default : mixed = null
-
Default value if not set.
- $separator : string|null = null
-
Separator, defaults to '.'
Return values
array<string|int, mixed> —Key/Value pairs of the properties.
group()
Group items in the collection by a field.
public
group(string $property[, string|null $separator = null ]) : array<string|int, mixed>
Parameters
- $property : string
-
Object property to be used to make groups.
- $separator : string|null = null
-
Separator, defaults to '.'
Return values
array<string|int, mixed>hasNestedProperty()
public
hasNestedProperty(string $property[, string|null $separator = null ]) : array<string|int, mixed>
Parameters
- $property : string
-
Object property to be matched.
- $separator : string|null = null
-
Separator, defaults to '.'
Return values
array<string|int, mixed> —Key/Value pairs of the properties.
setNestedProperty()
public
setNestedProperty(string $property, mixed $value[, string|null $separator = null ]) : $this
Parameters
- $property : string
-
Object property to be updated.
- $value : mixed
-
New value.
- $separator : string|null = null
-
Separator, defaults to '.'
Return values
$thisunsetNestedProperty()
public
unsetNestedProperty(string $property[, string|null $separator = null ]) : $this
Parameters
- $property : string
-
Object property to be updated.
- $separator : string|null = null
-
Separator, defaults to '.'