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;
    }