src/Middleware/Dispatcher.php
protected function resolve($index)
    {
        $callback = null;

        $stack = $this->stack;

        if (isset($this->stack[$index])) {
            $item = $stack[$index];

            $next = $this->resolve($index + 1);

            $callback = function ($request) use ($item, $next) {
                return $item->process($request, $next);
            };
        }

        return new Delegate($callback);
    }
protected function resolve($index)
    {
        $callback = null;

        $stack = $this->stack;

        if (isset($this->stack[$index])) {
            $item = $stack[$index];

            $next = $this->resolve($index + 1);

            $callback = function ($request) use ($item, $next) {
                return $item->process($request, $next);
            };
        }

        return new Delegate($callback);
    }
Resolves the whole stack through its index.

@param  integer $index
@return \Rougin\Slytherin\Middleware\HandlerInterface