src/TemplateRenderer/TemplateResolver.php
public function setTemplate($name, $path)
    {
        if (! isset($this->templates[$name])) {
            throw new UnexpectedValueException(sprintf(
                'Unexpected template name "%s" provided.',
                is_string($name) ? $name : gettype($name)
            ));
        }

        $finfo    = new SplFileInfo($path);
        $realPath = $finfo->getRealPath();
        if (! $realPath) {
            throw new InvalidArgumentException(sprintf(
                'Invalid path "%s" of template "%s" provided.',
                $path,
                $name
            ));
        }
        $extension = $finfo->getExtension();
        if ('phtml' !== $extension) {
            throw new InvalidArgumentException(sprintf(
                'Invalid file extension "%s" of template "%s"; the extension '
                . 'of template file must be "phtml".',
                $extension,
                $name
            ));
        }
        $this->templates[$name] = $realPath;
    }
public function setTemplate($name, $path)
    {
        if (! isset($this->templates[$name])) {
            throw new UnexpectedValueException(sprintf(
                'Unexpected template name "%s" provided.',
                is_string($name) ? $name : gettype($name)
            ));
        }

        $finfo    = new SplFileInfo($path);
        $realPath = $finfo->getRealPath();
        if (! $realPath) {
            throw new InvalidArgumentException(sprintf(
                'Invalid path "%s" of template "%s" provided.',
                $path,
                $name
            ));
        }
        $extension = $finfo->getExtension();
        if ('phtml' !== $extension) {
            throw new InvalidArgumentException(sprintf(
                'Invalid file extension "%s" of template "%s"; the extension '
                . 'of template file must be "phtml".',
                $extension,
                $name
            ));
        }
        $this->templates[$name] = $realPath;
    }
public function setTemplate ( $ name , $ path ) { if ( ! isset ( $ this -> templates [ $ name ] ) ) { throw new UnexpectedValueException ( sprintf ( 'Unexpected template name "%s" provided.' , is_string ( $ name ) ? $ name : gettype ( $ name ) ) ) ; } $ finfo = new SplFileInfo ( $ path ) ; $ realPath = $ finfo -> getRealPath ( ) ; if ( ! $ realPath ) { throw new InvalidArgumentException ( sprintf ( 'Invalid path "%s" of template "%s" provided.' , $ path , $ name ) ) ; } $ extension = $ finfo -> getExtension ( ) ; if ( 'phtml' !== $ extension ) { throw new InvalidArgumentException ( sprintf ( 'Invalid file extension "%s" of template "%s"; the extension ' . 'of template file must be "phtml".' , $ extension , $ name ) ) ; } $ this -> templates [ $ name ] = $ realPath ; }
Sets template.

@param string $name The name of template
@param string $path The path to template

@throws \UnexpectedValueException If non-standart template name specified
@throws \InvalidArgumentException

- If specified template file not exists
- If the extension of template file is not "phtml"
Sets template .