protected function resolveType($type, string $uri, Engine $engine = null): View
    {
        $configKey = [static::VIEW_FINDER_KEY, 'Views', $type];

        if (is_string($type) && $this->config->hasKey($configKey)) {
            $className = $this->config->getKey($configKey);
            $type      = new $className($uri, $engine, $this);
        }

        if (is_string($type)) {
            $type = new $type($uri, $engine, $this);
        }

        if (is_callable($type)) {
            $type = $type($uri, $engine, $this);
        }

        if (! $type instanceof View) {
            throw new FailedToInstantiateView(
                sprintf(
                    _('Could not instantiate view "%s".'),
                    serialize($type)
                )
            );
        }

        return $type;
    }
protected function resolveType($type, string $uri, Engine $engine = null): View
    {
        $configKey = [static::VIEW_FINDER_KEY, 'Views', $type];

        if (is_string($type) && $this->config->hasKey($configKey)) {
            $className = $this->config->getKey($configKey);
            $type      = new $className($uri, $engine, $this);
        }

        if (is_string($type)) {
            $type = new $type($uri, $engine, $this);
        }

        if (is_callable($type)) {
            $type = $type($uri, $engine, $this);
        }

        if (! $type instanceof View) {
            throw new FailedToInstantiateView(
                sprintf(
                    _('Could not instantiate view "%s".'),
                    serialize($type)
                )
            );
        }

        return $type;
    }
protected function resolveType ( $ type , string $ uri , Engine $ engine = null ) : View { $ configKey = [ static :: VIEW_FINDER_KEY , 'Views' , $ type ] ; if ( is_string ( $ type ) && $ this -> config -> hasKey ( $ configKey ) ) { $ className = $ this -> config -> getKey ( $ configKey ) ; $ type = new $ className ( $ uri , $ engine , $ this ) ; } if ( is_string ( $ type ) ) { $ type = new $ type ( $ uri , $ engine , $ this ) ; } if ( is_callable ( $ type ) ) { $ type = $ type ( $ uri , $ engine , $ this ) ; } if ( ! $ type instanceof View ) { throw new FailedToInstantiateView ( sprintf ( _ ( 'Could not instantiate view "%s".' ) , serialize ( $ type ) ) ) ; } return $ type ; }
Resolve the view type.

@since 0.1.0

@param mixed       $type   Type of view that was requested.
@param string      $uri    URI to get a view for.
@param Engine|null $engine Engine to use for the view.

@return View Resolved View object.
@throws FailedToInstantiateView If the view type could not be resolved.
Resolve the view type .