Extender
Extender
The Class Extender Class.
The Extender Class allows (or simulates) multiple class inheritance in PHP. It does this by loading instances of the extended class under the covers and transparently passing non-existent method calls on to 'child' classes (if the method exist). It will also work with member variables and honors the private, protected and public variable definitions.
Properties
children
private array $childrenmethods
private array $methodsproperties
private array $propertiesMethods
__call
This method call router will route the method call to the first child class that was
public __call(string $method, array $args): voidfound to have the requested method. If the method does not exist an \Exception is thrown.
Parameters
| Parameter | Type | Description |
|---|---|---|
$method | string | Then name of the method being called |
$args | array | An array of arguments from the method call |
__toString
Pass through method for converting the element to a string. If one of the child classes
public __toString(): stringhad a __tostring() method then this method is called on the first child that has it.
__get
Get a property from the instantiated class object for properties that do not exist. This will
public __get(string $property): mixedreturn the value of a property if it exists in a child class. This method honors the private, protected and public variable declarations.
Parameters
| Parameter | Type | Description |
|---|---|---|
$property | string | The property being requested |
__set
Set a property on the instantiated class object for properties that do not exist. This will
public __set(string $property, mixed $value): voidset the value of a property if it exists in a child class. This method honors the private, protected and public variable declarations. If the child class variable is not meant to be accessible, either by not existing, or being set public, or being protected and the call originated outside the object, then the variable is created on the fly in the main object. This is the same as a normal object.
Parameters
| Parameter | Type | Description |
|---|---|---|
$property | string | The property being set |
$value | mixed | The value to set |
Test if the class extends another class.
public (string $class): boolThis implements the "instanceof" functionality of PHP and searches all the child classes to see if any of them extend the specified class.
Parameters
| Parameter | Type | Description |
|---|---|---|
$class | string | The name of the class to test |
extendedFrom
Checks if any child class extends from the specified class.
public extendedFrom(string $class): boolParameters
| Parameter | Type | Description |
|---|---|---|
$class | string | the class name to check against |
extend
Extend a class with a child class.
protected extend(string $class, mixed $args): boolThe arguments are as follows:
The name of the class to inherit from
A list of arguments to pass on to the class constructor
Parameters
| Parameter | Type | Description |
|---|---|---|
$class | string | |
$args | mixed |
Generated by Hazaar API Doc Generator on Sun, 01 Mar 2026 09:22:26 +0000