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