src/Core/Extensible.php
public function extend($method, &$a1 = null, &$a2 = null, &$a3 = null, &$a4 = null, &$a5 = null, &$a6 = null, &$a7 = null)
    {
        $values = array();

        if (!empty($this->beforeExtendCallbacks[$method])) {
            foreach (array_reverse($this->beforeExtendCallbacks[$method]) as $callback) {
                $value = call_user_func_array($callback, array(&$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7));
                if ($value !== null) {
                    $values[] = $value;
                }
            }
            $this->beforeExtendCallbacks[$method] = array();
        }

        foreach ($this->getExtensionInstances() as $instance) {
            if (method_exists($instance, $method)) {
                try {
                    $instance->setOwner($this);
                    $value = $instance->$method($a1, $a2, $a3, $a4, $a5, $a6, $a7);
                } finally {
                    $instance->clearOwner();
                }
                if ($value !== null) {
                    $values[] = $value;
                }
            }
        }

        if (!empty($this->afterExtendCallbacks[$method])) {
            foreach (array_reverse($this->afterExtendCallbacks[$method]) as $callback) {
                $value = call_user_func_array($callback, array(&$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7));
                if ($value !== null) {
                    $values[] = $value;
                }
            }
            $this->afterExtendCallbacks[$method] = array();
        }

        return $values;
    }
public function extend($method, &$a1 = null, &$a2 = null, &$a3 = null, &$a4 = null, &$a5 = null, &$a6 = null, &$a7 = null)
    {
        $values = array();

        if (!empty($this->beforeExtendCallbacks[$method])) {
            foreach (array_reverse($this->beforeExtendCallbacks[$method]) as $callback) {
                $value = call_user_func_array($callback, array(&$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7));
                if ($value !== null) {
                    $values[] = $value;
                }
            }
            $this->beforeExtendCallbacks[$method] = array();
        }

        foreach ($this->getExtensionInstances() as $instance) {
            if (method_exists($instance, $method)) {
                try {
                    $instance->setOwner($this);
                    $value = $instance->$method($a1, $a2, $a3, $a4, $a5, $a6, $a7);
                } finally {
                    $instance->clearOwner();
                }
                if ($value !== null) {
                    $values[] = $value;
                }
            }
        }

        if (!empty($this->afterExtendCallbacks[$method])) {
            foreach (array_reverse($this->afterExtendCallbacks[$method]) as $callback) {
                $value = call_user_func_array($callback, array(&$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7));
                if ($value !== null) {
                    $values[] = $value;
                }
            }
            $this->afterExtendCallbacks[$method] = array();
        }

        return $values;
    }
public function extend ( $ method , & $ a1 = null , & $ a2 = null , & $ a3 = null , & $ a4 = null , & $ a5 = null , & $ a6 = null , & $ a7 = null ) { $ values = array ( ) ; if ( ! empty ( $ this -> beforeExtendCallbacks [ $ method ] ) ) { foreach ( array_reverse ( $ this -> beforeExtendCallbacks [ $ method ] ) as $ callback ) { $ value = call_user_func_array ( $ callback , array ( & $ a1 , & $ a2 , & $ a3 , & $ a4 , & $ a5 , & $ a6 , & $ a7 ) ) ; if ( $ value !== null ) { $ values [ ] = $ value ; } } $ this -> beforeExtendCallbacks [ $ method ] = array ( ) ; } foreach ( $ this -> getExtensionInstances ( ) as $ instance ) { if ( method_exists ( $ instance , $ method ) ) { try { $ instance -> setOwner ( $ this ) ; $ value = $ instance -> $ method ( $ a1 , $ a2 , $ a3 , $ a4 , $ a5 , $ a6 , $ a7 ) ; } finally { $ instance -> clearOwner ( ) ; } if ( $ value !== null ) { $ values [ ] = $ value ; } } } if ( ! empty ( $ this -> afterExtendCallbacks [ $ method ] ) ) { foreach ( array_reverse ( $ this -> afterExtendCallbacks [ $ method ] ) as $ callback ) { $ value = call_user_func_array ( $ callback , array ( & $ a1 , & $ a2 , & $ a3 , & $ a4 , & $ a5 , & $ a6 , & $ a7 ) ) ; if ( $ value !== null ) { $ values [ ] = $ value ; } } $ this -> afterExtendCallbacks [ $ method ] = array ( ) ; } return $ values ; }
Run the given function on all of this object's extensions. Note that this method originally returned void, so if
you wanted to return results, you're hosed

Currently returns an array, with an index resulting every time the function is called. Only adds returns if
they're not NULL, to avoid bogus results from methods just defined on the parent extension. This is important for
permission-checks through extend, as they use min() to determine if any of the returns is FALSE. As min() doesn't
do type checking, an included NULL return would fail the permission checks.

The extension methods are defined during {@link __construct()} in {@link defineMethods()}.

@param string $method the name of the method to call on each extension
@param mixed $a1
@param mixed $a2
@param mixed $a3
@param mixed $a4
@param mixed $a5
@param mixed $a6
@param mixed $a7
@return array
Run the given function on all of this object s extensions . Note that this method originally returned void so if you wanted to return results you re hosed