\Hazaar
Extender
Abstract
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.

Tags

Since

1.2

Summary
Methods Properties Constants
No constants
Properties
$children
$children
$methods
$methods
$properties
$properties
Methods
__call()
__call($method, $args = Array ( ) ) : mixed

This method call router will route the method call to the first child class that was found to have the requested method. If the method does not exist an \Exception is thrown.

Tags

Since

1.2

Throws

\Exception

Parameters

$methodstring

Then name of the method being called

$argsArray

An array of arguments from the method call

Returns

mixed

The returned data from the child method

__get()
__get($property) : mixed

Get a property from the instantiated class object for properties that do not exist. This will return the value of a property if it exists in a child class. This method honors the private, protected and public variable declarations.

Tags

Since

1.2

Parameters

$propertystring

The property being requested

Returns

mixed

The value of the property

__set()
__set($property, $value)

Set a property on the instantiated class object for properties that do not exist. This will set 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.

Tags

Since

1.2

Parameters

$propertystring

The property being set

$valuemixed

The value to set

__tostring()
__tostring() : string

Pass through method for converting the element to a string. If one of the child classes had a __tostring() method then this method is called on the first child that has it.

Tags

Since

1.2

Returns

string
extend()
extend() : bool

Extend a class with a child class.

The arguments are as follows:

  1. The name of the class to inherit from
  2. … A list of arguments to pass on to the class constructor

Tags

Since

1.2

Throws

\Exception

Returns

\Hazaar\bool

Returns true if the class was successfully extended.