Objectable
trait Objectable (View source)
This trait provides magic methods for dynamic property access and manipulation, including getter, setter, isset, and unset operations. Supports serialization
and deserialization through __sleep and __wakeup methods. Converts object properties to an associative array with the toArray method.
Methods:
__get(string $name): mixed:Magic getter method__set(string $name, mixed $value): void:Magic setter method to dynamically set properties.__isset(string $name): bool:This method is triggered by calling isset() or empty() on inaccessible (protected or private) or non-existing properties.__unset(string $name): void:This method is invoked when unset() is used on inaccessible (protected or private) or non-existing properties.__sleep(): array:Sleep instance used by serialize/unserialize__wakeup(): void:Wakeup instance used by serialize/unserializetoArray(): array:Returns the object properties as an associative array
Methods
Magic getter method
Magic setter method to dynamically set properties.
This method is triggered by calling isset() or empty() on inaccessible (protected or private) or non-existing properties.
This method is invoked when unset() is used on inaccessible (protected or private) or non-existing properties.
Sleep instance used by serialize/unserialize
Wakeup instance used by serialize/unserialize
Returns the object properties as an associative array
Details
mixed
__get(string $name)
Magic getter method
void
__set(string $name, mixed $value)
Magic setter method to dynamically set properties.
If the property is an array and already exists as an instance of the current class, it will recursively set each key-value pair on the existing instance. Otherwise, it assigns the value directly to the property.
bool
__isset(string $name)
This method is triggered by calling isset() or empty() on inaccessible (protected or private) or non-existing properties.
void
__unset(string $name)
This method is invoked when unset() is used on inaccessible (protected or private) or non-existing properties.
array
__sleep()
Sleep instance used by serialize/unserialize
void
__wakeup()
Wakeup instance used by serialize/unserialize
array
toArray()
Returns the object properties as an associative array