PropertyObject
in package
implements
NestedObjectInterface, ArrayAccess
uses
ObjectTrait, ObjectPropertyTrait, NestedPropertyTrait, OverloadedPropertyTrait, NestedArrayAccessTrait
Property Objects keep their data in protected object properties.
Tags
Table of Contents
Interfaces
- NestedObjectInterface
- Common Interface for both Objects and Collections
- ArrayAccess
Properties
- $type : string
- $_definedProperties : array<string|int, mixed>
- $_key : string
Methods
- __construct() : mixed
- __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
- initObjectProperties() : void
- isPropertyLoaded() : bool
- offsetLoad() : mixed
- offsetPrepare() : mixed
- offsetSerialize() : mixed
- setElements() : void
- setKey() : $this
Properties
$type
protected
static string
$type
$_definedProperties
private
array<string|int, mixed>
$_definedProperties
$_key
private
string
$_key
Methods
__construct()
public
__construct([array<string|int, mixed> $elements = [] ][, string|null $key = null ]) : mixed
Parameters
- $elements : array<string|int, mixed> = []
- $key : string|null = null
Tags
__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
Return values
$thisdefProperty()
public
defProperty(string $property, mixed $default) : $this
Parameters
- $property : string
-
Object property to be defined.
- $default : mixed
-
Default value.
Return values
$thisgetKey()
public
getKey() : string
Return values
stringgetNestedProperty()
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
stringhasKey()
public
hasKey() : bool
Return values
boolhasNestedProperty()
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
Return values
$thissetProperty()
public
setProperty(string $property, mixed $value) : $this
Parameters
- $property : string
-
Object property to be updated.
- $value : mixed
-
New value.
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 '.'
Tags
Return values
$thisunsetProperty()
public
unsetProperty(string $property) : $this
Parameters
- $property : string
-
Object property to be unset.
Return values
$thisdoGetProperty()
protected
& doGetProperty(string $property[, mixed $default = null ][, callable|bool $doCreate = false ]) : mixed
Parameters
- $property : string
-
Object property to be fetched.
- $default : mixed = null
-
Default value if property has not been set.
- $doCreate : callable|bool = false
-
Set true to create variable.
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.
Tags
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|nullgetElements()
protected
getElements() : array<string|int, mixed>
Return values
array<string|int, mixed>getTypePrefix()
protected
getTypePrefix() : string
Return values
stringinitObjectProperties()
protected
initObjectProperties() : void
isPropertyLoaded()
protected
isPropertyLoaded(string $property) : bool
Parameters
- $property : string
-
Object property name.
Return values
bool —True if property has been loaded.
offsetLoad()
protected
offsetLoad(string $offset, mixed $value) : mixed
Parameters
- $offset : string
- $value : mixed
offsetPrepare()
protected
offsetPrepare(string $offset, mixed $value) : mixed
Parameters
- $offset : string
- $value : mixed
offsetSerialize()
protected
offsetSerialize(string $offset, mixed $value) : mixed
Parameters
- $offset : string
- $value : mixed
setElements()
protected
setElements(array<string|int, mixed> $elements) : void
Parameters
- $elements : array<string|int, mixed>
setKey()
protected
setKey(string $key) : $this
Parameters
- $key : string