Library
Class

Library\Object\AbstractInvokable

abstract class AbstractInvokable implements InvokableInterface

Magic handling of properties access

Presentation

This model constructs an accessible object in which you can dynamically set and get properties on the fly without errors.

The visibility of properties is kept for direct set or get.

Rules

All setter methods returns the object itself for chainability.

To use static magic caller, your constructor must not require any argument.

Methods

mixed __invoke(string $name)

Magic getter when calling an object as a function

mixed __call(string $name, array $arguments)

Magic handler when calling a non-existing method on an object

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

Magic handler when calling a non-eixsting method statically on an object

mixed __get(string $name)

Magic getter

AbstractInvokable __set(string $name, mixed $value)

Magic setter

bool __isset(string $name)

Magic checker

AbstractInvokable __unset(string $name)

Magic unsetter

string findPropertyName(string $name)

Search a property name in the current object with one or tow leading underscores

static string findPropertyNameStatic(string $name, string|object $object)

Search a property name in the current object with one or tow leading underscores

Details

at line 68
public mixed __invoke(string $name)

Magic getter when calling an object as a function

Parameters

string $name The property name called on the object

Return Value

mixed This will return the result of the magic getter, or nothing if nothing can be done

See also

<http://www.php.net/manual/en/language.oop5.magic.php>
Library\Object\AbstractInvokable::_invokeGet()

at line 96
public mixed __call(string $name, array $arguments)

Magic handler when calling a non-existing method on an object

Magic method handling getProp(default), setProp(value), unsetProp(), issetProp() or resetProp().

Parameters

string $name The non-existing method name called on the object
array $arguments The arguments array passed calling the method

Return Value

mixed This will return the result of a magic method, or nothing if nothing can be done

See also

<http://www.php.net/manual/en/language.oop5.overloading.php>
Library\Object\AbstractInvokable::_invokeIsset()
Library\Object\AbstractInvokable::_invokeReset()
Library\Object\AbstractInvokable::_invokeUnset()
Library\Object\AbstractInvokable::_invokeSet()
Library\Object\AbstractInvokable::_invokeGet()

at line 141
static public mixed __callStatic(string $name, array $arguments)

Magic handler when calling a non-eixsting method statically on an object

Magic static handling of getProp(default), setProp(value), unsetProp(), issetProp() or resetProp().

Parameters

string $name The non-existing method name called on the object
array $arguments The arguments array passed calling the method

Return Value

mixed This will return the result of a magic method, or nothing if nothing can be done

See also

<http://www.php.net/manual/en/language.oop5.overloading.php>

at line 176
public mixed __get(string $name)

Magic getter

Magic method called when $this->prop is invoked.

Parameters

string $name The name of the property to get

Return Value

mixed This will return the result of a magic method, or nothing if nothing can be done

See also

<http://www.php.net/manual/en/language.oop5.overloading.php>
Library\Object\AbstractInvokable::_invokeGet()

at line 193
public AbstractInvokable __set(string $name, mixed $value)

Magic setter

Magic method called when $this->arg = value is invoked.

Parameters

string $name The name of the property to get
mixed $value The value to set for the property

Return Value

AbstractInvokable Returns $this for method chaining

See also

<http://www.php.net/manual/en/language.oop5.overloading.php>
Library\Object\AbstractInvokable::_invokeSet()

at line 209
public bool __isset(string $name)

Magic checker

Magic method called when isset($this->prop) or empty($this->prop) are invoked.

Parameters

string $name The name of the property to get

Return Value

bool This will return true if the property exists, false otherwise

See also

<http://www.php.net/manual/en/language.oop5.overloading.php>
Library\Object\AbstractInvokable::_invokeIsset()

at line 225
public AbstractInvokable __unset(string $name)

Magic unsetter

Magic method called when unset($this->prop) is invoked.

Parameters

string $name The name of the property to get

Return Value

AbstractInvokable Returns $this for method chaining

See also

<http://www.php.net/manual/en/language.oop5.overloading.php>
Library\Object\AbstractInvokable::_invokeUnset()

at line 415
public string findPropertyName(string $name)

Search a property name in the current object with one or tow leading underscores

Parameters

string $name The property name to transform

Return Value

string The transformed property name

at line 427
static public string findPropertyNameStatic(string $name, string|object $object)

Search a property name in the current object with one or tow leading underscores

Parameters

string $name The property name to transform
string|object $object The object or a class name to work on

Return Value

string The transformed property name