protected function parseMiddleware($name)
    {
        list($name, $parameters) = array_pad(explode(':', $name, 2), 2, null);

        //
        $callable = isset($this->middleware[$name]) ? $this->middleware[$name] : $name;

        if (is_null($parameters)) {
            return $callable;
        }

        // When the callable is a string, we will add back the parameters before returning.
        else if (is_string($callable)) {
            return $callable .':' .$parameters;
        }

        // A callback with parameters; we should create a proper middleware closure for it.
        $parameters = explode(',', $parameters);

        return function ($passable, $stack) use ($callable, $parameters)
        {
            return call_user_func_array(
                $callable, array_merge(array($passable, $stack), $parameters)
            );
        };
    }