src/Http/Response.php
public function template($name, array $params = []): ResponseInterface
    {
        if (\is_array($name)) {
            $params = $name;
            $name = null;
        }

        if ($name === null) {
            $handler = $this->app->handler();
            if ($handler instanceof \Closure) {
                throw new \LogicException('Con not build the template from closure handler!');
            }

            $name = \ltrim($handler['app'] . '/' . $handler['controller'] . '/' . $handler['action'], '/');
        } elseif (!\is_string($name)) {
            throw new \InvalidArgumentException('Template name not found!');
        }

        $response = $this->response();

        return $this->app->render($response, $name, $params);
    }
public function template($name, array $params = []): ResponseInterface
    {
        if (\is_array($name)) {
            $params = $name;
            $name = null;
        }

        if ($name === null) {
            $handler = $this->app->handler();
            if ($handler instanceof \Closure) {
                throw new \LogicException('Con not build the template from closure handler!');
            }

            $name = \ltrim($handler['app'] . '/' . $handler['controller'] . '/' . $handler['action'], '/');
        } elseif (!\is_string($name)) {
            throw new \InvalidArgumentException('Template name not found!');
        }

        $response = $this->response();

        return $this->app->render($response, $name, $params);
    }
public function template ( $ name , array $ params = [ ] ) : ResponseInterface { if ( \ is_array ( $ name ) ) { $ params = $ name ; $ name = null ; } if ( $ name === null ) { $ handler = $ this -> app -> handler ( ) ; if ( $ handler instanceof \ Closure ) { throw new \ LogicException ( 'Con not build the template from closure handler!' ) ; } $ name = \ ltrim ( $ handler [ 'app' ] . '/' . $ handler [ 'controller' ] . '/' . $ handler [ 'action' ] , '/' ) ; } elseif ( ! \ is_string ( $ name ) ) { throw new \ InvalidArgumentException ( 'Template name not found!' ) ; } $ response = $ this -> response ( ) ; return $ this -> app -> render ( $ response , $ name , $ params ) ; }
Get or set template name

@param string|array|null $name
@param array $params

@return ResponseInterface

@throws \InvalidArgumentException
@throws \LogicException
Get or set template name