trait Methods (View source)

This trait provides magic methods for dynamic property access and manipulation and also includes methods for getting, setting, checking existence, and unsetting properties dynamically. It also handles serialization and deserialization of the property using the __sleep and __wakeup magic methods.

Methods:

  • __construct(array $property = []): Constructor to initialize the Settings object.
  • __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/unserialize

Fields:

  • $property: Stores settings for dynamic property access.

Properties

Settings|null $property

Property to store settings

Methods

__construct()

No description

mixed
__get(string $name)

Magic method to access dynamic properties

void
__set(string $name, mixed $value)

Magic method to set dynamic properties

bool
__isset(string $name)

Magic method to check if a property exists

void
__unset(string $name)

Magic method to remove a property

array
__sleep()

Magic method for serialization

void
__wakeup()

Magic method for deserialization

Details

__construct()

No description

mixed __get(string $name)

Magic method to access dynamic properties

Parameters

string $name

Property name

Return Value

mixed

void __set(string $name, mixed $value)

Magic method to set dynamic properties

Parameters

string $name

Property name

mixed $value

Value to be assigned

Return Value

void

bool __isset(string $name)

Magic method to check if a property exists

Parameters

string $name

Property name

Return Value

bool

void __unset(string $name)

Magic method to remove a property

Parameters

string $name

Property name

Return Value

void

array __sleep()

Magic method for serialization

Return Value

array

void __wakeup()

Magic method for deserialization

Return Value

void