traits/StaticallyExtendable.php
public static function extend($name, callable $callable = null)
    {
        if (!is_array($name)) {
            if (null === $callable) {
                throw new \InvalidArgumentException("A callable must be given as second parameter if the first is not an array.");
            }

            self::$extensions[$name] = $callable;
            return;
        }

        foreach ($name as $method => $callable) {
            if (!is_callable($callable)) {
                throw new \InvalidArgumentException("The values of an array passed to the extend() method must be callables.");
            }

            self::$extensions[$method] = $callable;
        }
    }
public static function extend($name, callable $callable = null)
    {
        if (!is_array($name)) {
            if (null === $callable) {
                throw new \InvalidArgumentException("A callable must be given as second parameter if the first is not an array.");
            }

            self::$extensions[$name] = $callable;
            return;
        }

        foreach ($name as $method => $callable) {
            if (!is_callable($callable)) {
                throw new \InvalidArgumentException("The values of an array passed to the extend() method must be callables.");
            }

            self::$extensions[$method] = $callable;
        }
    }
public static function extend ( $ name , callable $ callable = null ) { if ( ! is_array ( $ name ) ) { if ( null === $ callable ) { throw new \ InvalidArgumentException ( "A callable must be given as second parameter if the first is not an array." ) ; } self :: $ extensions [ $ name ] = $ callable ; return ; } foreach ( $ name as $ method => $ callable ) { if ( ! is_callable ( $ callable ) ) { throw new \ InvalidArgumentException ( "The values of an array passed to the extend() method must be callables." ) ; } self :: $ extensions [ $ method ] = $ callable ; } }
Registers an additional static method.

@param   string|array    $name       The name the callable should be made available as or an array of
name => callable pairs.
@param   callable        $callable   The actual code that should be called.
@throws  \InvalidArgumentException   When the first parameter is not an array and the second is not given or
when an array is given and its values are not callables.
Registers an additional static method .