protected function resolve($index)
    {
        if (!isset($this->queue[$index])) {
            return null;
        }

        if (is_string($this->queue[$index])) {
            $class = $this->queue[$index];
            $className = App::className($class, 'Middleware', 'Middleware');
            if (!$className || !class_exists($className)) {
                throw new RuntimeException(sprintf(
                    'Middleware "%s" was not found.',
                    $class
                ));
            }
            $callable = new $className;
        } else {
            $callable = $this->queue[$index];
        }

        return $this->callables[$index] = $callable;
    }
protected function resolve($index)
    {
        if (!isset($this->queue[$index])) {
            return null;
        }

        if (is_string($this->queue[$index])) {
            $class = $this->queue[$index];
            $className = App::className($class, 'Middleware', 'Middleware');
            if (!$className || !class_exists($className)) {
                throw new RuntimeException(sprintf(
                    'Middleware "%s" was not found.',
                    $class
                ));
            }
            $callable = new $className;
        } else {
            $callable = $this->queue[$index];
        }

        return $this->callables[$index] = $callable;
    }
protected function resolve ( $ index ) { if ( ! isset ( $ this -> queue [ $ index ] ) ) { return null ; } if ( is_string ( $ this -> queue [ $ index ] ) ) { $ class = $ this -> queue [ $ index ] ; $ className = App :: className ( $ class , 'Middleware' , 'Middleware' ) ; if ( ! $ className || ! class_exists ( $ className ) ) { throw new RuntimeException ( sprintf ( 'Middleware "%s" was not found.' , $ class ) ) ; } $ callable = new $ className ; } else { $ callable = $ this -> queue [ $ index ] ; } return $ this -> callables [ $ index ] = $ callable ; }
Resolve middleware name to callable.

@param int $index The index to fetch.
@return callable|null Either the callable middleware or null
if the index is undefined.
Resolve middleware name to callable .