trait Caller (View source)

This trait uses the Getter and Setter traits to facilitate dynamic property access. The __call method handles instance method calls, while __callStatic manages static method calls. Both methods interpret method names starting with 'set' or 'get' to perform corresponding actions on properties.

Methods:

  • __get(string $name): mixed: Retrieves the value of a property if it exists, or returns null if the property is inaccessible or non-existent.
  • __set(string $name, mixed $value): void: Magic method to set the value of inaccessible or non-existing properties.
  • __call(string $name, array $arguments): mixed: Handles dynamic instance method calls.
  • __callStatic(string $name, array $arguments): mixed: Handles dynamic static method calls.

Fields:

  • $property: Stores properties for dynamic property access.

Traits

This trait is utilized for reading data from inaccessible (protected or private) or non-existing properties.

This trait is run when writing data to inaccessible (protected or private) or non-existing properties.

This trait provides a private array property intended for use with magic setter and getter methods.

This trait provides a private array property intended for use with magic setter and getter methods.

Methods

mixed
__get(string $name)

Magic method to get the value of inaccessible or non-existing properties.

from  Getter
void
__set(string $name, mixed $value)

This method is run when writing data to inaccessible (protected or private) or non-existing properties.

from  Setter
mixed
__call(string $name, array $arguments)

Triggered when invoking inaccessible methods in an object context

static mixed
__callStatic(string $name, array $arguments)

Triggered when invoking inaccessible methods in a static context

Details

mixed __get(string $name)

Magic method to get the value of inaccessible or non-existing properties.

Parameters

string $name

Property name

Return Value

mixed

The property value

void __set(string $name, mixed $value)

This method is run when writing data to inaccessible (protected or private) or non-existing properties.

Parameters

string $name

Argument to be tested

mixed $value

The value to be defined

Return Value

void

mixed __call(string $name, array $arguments)

Triggered when invoking inaccessible methods in an object context

Parameters

string $name

Name of the method

array $arguments

Array of arguments

Return Value

mixed

static mixed __callStatic(string $name, array $arguments)

Triggered when invoking inaccessible methods in a static context

Parameters

string $name

Name of the static method

array $arguments

Array of arguments

Return Value

mixed

Exceptions

Exceptions
ReflectionException