public static function patched($namespace, $className, $methodName, &$substitute = null)
    {
        $name = $className ?: $methodName;

        if ($namespace && ($className || function_exists("{$namespace}\\{$name}"))) {
            $name = "{$namespace}\\{$name}";
        }

        $method = isset(static::$_registered[$name]) ? static::$_registered[$name] : null;

        if (!$methodName) {
            $fake = $method ? $method->substitute() : null;
            if (is_object($fake)) {
                $substitute = $fake;
            }
            return $fake ?: $name;
        }

        if (!$method) {
            if (!Suite::registered($name)) {
                return $name;
            }
        } elseif ($method->actsAsAReplacement()) {
            return $method->closure();
        }

        return function () use ($name, $method) {
            $args = func_get_args();

            if (Suite::registered($name)) {
                Calls::log(null, compact('name', 'args'));
            }
            if ($method && $method->matchArgs($args)) {
                return $method($args);
            }
            return call_user_func_array($name, $args);
        };
    }