ObjectTrait uses trait:short
Object trait.
Table of Contents
Properties
Methods
- __serialize() : array<string|int, mixed>
- __toString() : string
- Returns a string representation of this object.
- __unserialize() : void
- defProperty() : $this
- getKey() : string
- getProperty() : mixed
- getType() : string
- hasKey() : bool
- hasProperty() : bool
- jsonSerialize() : array<string|int, mixed>
- Implements JsonSerializable interface.
- serialize() : string
- setProperty() : $this
- unserialize() : void
- unsetProperty() : $this
- doSerialize() : array<string|int, mixed>
- doUnserialize() : void
- getTypePrefix() : string
- getUnserializeAllowedClasses() : array<string|int, mixed>|bool
- setKey() : $this
Properties
$type
protected
static string
$type
$_key
private
string
$_key
Methods
__serialize()
public
final __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__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>
defProperty()
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
stringgetProperty()
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
boolhasProperty()
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>serialize()
public
final serialize() : string
Return values
stringsetProperty()
public
setProperty(string $property, mixed $value) : $this
Parameters
- $property : string
-
Object property to be updated.
- $value : mixed
-
New value.
Return values
$thisunserialize()
public
final unserialize(string $serialized) : void
Parameters
- $serialized : string
unsetProperty()
public
unsetProperty(string $property) : $this
Parameters
- $property : string
-
Object property to be unset.
Return values
$thisdoSerialize()
protected
doSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>doUnserialize()
protected
doUnserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
getTypePrefix()
protected
getTypePrefix() : string
Return values
stringgetUnserializeAllowedClasses()
protected
getUnserializeAllowedClasses() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|boolsetKey()
protected
setKey(string $key) : $this
Parameters
- $key : string