Documentation

LazyObject
in package
implements NestedObjectInterface, ArrayAccess uses ObjectTrait, LazyPropertyTrait, NestedPropertyTrait, OverloadedPropertyTrait, NestedArrayAccessTrait

Lazy Objects keep their data in both protected object properties and falls back to a stored array if property does not exist or is not initialized.

Tags
implements

Table of Contents

Interfaces

NestedObjectInterface
Common Interface for both Objects and Collections
ArrayAccess

Properties

$type  : string
$_key  : string

Methods

__get()  : mixed
Returns the value at specified offset.
__isset()  : bool
Checks whether or not an offset exists.
__serialize()  : array<string|int, mixed>
__set()  : void
Assigns a value to the specified offset.
__toString()  : string
Returns a string representation of this object.
__unserialize()  : void
__unset()  : void
Magic method to unset the attribute
defNestedProperty()  : $this
defProperty()  : $this
getKey()  : string
getNestedProperty()  : mixed
getProperty()  : mixed
getType()  : string
hasKey()  : bool
hasNestedProperty()  : bool
hasProperty()  : bool
jsonSerialize()  : array<string|int, mixed>
Implements JsonSerializable interface.
offsetExists()  : bool
Whether or not an offset exists.
offsetGet()  : mixed
Returns the value at specified offset.
offsetSet()  : void
Assigns a value to the specified offset.
offsetUnset()  : void
Unsets an offset.
setNestedProperty()  : $this
setProperty()  : $this
unsetNestedProperty()  : $this
unsetProperty()  : $this
doGetProperty()  : mixed
doHasProperty()  : bool
doSerialize()  : array<string|int, mixed>
doSetProperty()  : void
doUnserialize()  : void
doUnsetProperty()  : void
getElement()  : mixed|null
getElements()  : array<string|int, mixed>
getTypePrefix()  : string
setKey()  : $this

Properties

Methods

__get()

Returns the value at specified offset.

public __get(mixed $offset) : mixed
Parameters
$offset : mixed

The offset to retrieve.

Attributes
#[ReturnTypeWillChange]
Return values
mixed

Can return all value types.

__isset()

Checks whether or not an offset exists.

public __isset(mixed $offset) : bool
Parameters
$offset : mixed

An offset to check for.

Attributes
#[ReturnTypeWillChange]
Return values
bool

Returns TRUE on success or FALSE on failure.

__serialize()

public final __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__set()

Assigns a value to the specified offset.

public __set(mixed $offset, mixed $value) : void
Parameters
$offset : mixed

The offset to assign the value to.

$value : mixed

The value to set.

Attributes
#[ReturnTypeWillChange]

__toString()

Returns a string representation of this object.

public __toString() : string
Attributes
#[ReturnTypeWillChange]
Return values
string

__unserialize()

public final __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

__unset()

Magic method to unset the attribute

public __unset(mixed $offset) : void
Parameters
$offset : mixed

The name value to unset

Attributes
#[ReturnTypeWillChange]

defNestedProperty()

public defNestedProperty(string $property, mixed $default[, string|null $separator = null ]) : $this
Parameters
$property : string

Object property to be updated.

$default : mixed

Default value.

$separator : string|null = null

Separator, defaults to '.'

Tags
throws
RuntimeException
Return values
$this

defProperty()

public defProperty(string $property, mixed $default) : $this
Parameters
$property : string

Object property to be defined.

$default : mixed

Default value.

Return values
$this

getKey()

public getKey() : string
Return values
string

getNestedProperty()

public getNestedProperty(string $property[, mixed|null $default = null ][, string|null $separator = null ]) : mixed
Parameters
$property : string

Object property to be fetched.

$default : mixed|null = null

Default value if property has not been set.

$separator : string|null = null

Separator, defaults to '.'

Return values
mixed

Property value.

getProperty()

public getProperty(string $property[, mixed $default = null ]) : mixed
Parameters
$property : string

Object property to be fetched.

$default : mixed = null

Default value if property has not been set.

Return values
mixed

Property value.

getType()

public getType([bool $prefix = true ]) : string
Parameters
$prefix : bool = true
Return values
string

hasNestedProperty()

public hasNestedProperty(string $property[, string|null $separator = null ]) : bool
Parameters
$property : string

Object property name.

$separator : string|null = null

Separator, defaults to '.'

Return values
bool

True if property has been defined (can be null).

hasProperty()

public hasProperty(string $property) : bool
Parameters
$property : string

Object property name.

Return values
bool

True if property has been defined (can be null).

jsonSerialize()

Implements JsonSerializable interface.

public jsonSerialize() : array<string|int, mixed>
Attributes
#[ReturnTypeWillChange]
Return values
array<string|int, mixed>

offsetExists()

Whether or not an offset exists.

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed

An offset to check for.

Attributes
#[ReturnTypeWillChange]
Return values
bool

Returns TRUE on success or FALSE on failure.

offsetGet()

Returns the value at specified offset.

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed

The offset to retrieve.

Attributes
#[ReturnTypeWillChange]
Return values
mixed

Can return all value types.

offsetSet()

Assigns a value to the specified offset.

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed

The offset to assign the value to.

$value : mixed

The value to set.

Attributes
#[ReturnTypeWillChange]

offsetUnset()

Unsets an offset.

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed

The offset to unset.

Attributes
#[ReturnTypeWillChange]

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 '.'

Tags
throws
RuntimeException
Return values
$this

setProperty()

public setProperty(string $property, mixed $value) : $this
Parameters
$property : string

Object property to be updated.

$value : mixed

New value.

Return values
$this

unsetNestedProperty()

public unsetNestedProperty(string $property[, string|null $separator = null ]) : $this
Parameters
$property : string

Object property to be updated.

$separator : string|null = null

Separator, defaults to '.'

Tags
throws
RuntimeException
Return values
$this

unsetProperty()

public unsetProperty(string $property) : $this
Parameters
$property : string

Object property to be unset.

Return values
$this

doGetProperty()

protected & doGetProperty(string $property[, mixed $default = null ][, bool $doCreate = false ]) : mixed
Parameters
$property : string

Object property to be fetched.

$default : mixed = null

Default value if property has not been set.

$doCreate : bool = false
Return values
mixed

Property value.

doHasProperty()

protected doHasProperty(string $property) : bool
Parameters
$property : string

Object property name.

Return values
bool

True if property has been defined (can be null).

doSerialize()

protected doSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

doSetProperty()

protected doSetProperty(string $property, mixed $value) : void
Parameters
$property : string

Object property to be updated.

$value : mixed

New value.

doUnserialize()

protected doUnserialize(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>

doUnsetProperty()

protected doUnsetProperty(string $property) : void
Parameters
$property : string

Object property to be unset.

getElement()

protected getElement(string $property[, mixed|null $default = null ]) : mixed|null
Parameters
$property : string
$default : mixed|null = null
Return values
mixed|null

getElements()

protected getElements() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTypePrefix()

protected getTypePrefix() : string
Return values
string

setKey()

protected setKey(string $key) : $this
Parameters
$key : string
Return values
$this

        
On this page

Search results