public function addTemplatePath($templatePath, $namespace = null)
    {
        if (! is_dir($templatePath)) {
            throw new Exception\InvalidTemplatePathException(sprintf(
                '%s expects a valid path to a directory; received "%s"',
                __METHOD__,
                $templatePath
            ));
        }

        if (null !== $namespace && ! is_string($namespace)) {
            throw new Exception\InvalidNamespaceException('Namespace must be a string');
        }

        $namespace = $namespace ?: self::DEFAULT_NAMESPACE;

        $templatePath = rtrim((string) $templatePath, '/\\');
        $this->getTemplatePath($namespace)->push($templatePath);

        return $this;
    }
public function addTemplatePath($templatePath, $namespace = null)
    {
        if (! is_dir($templatePath)) {
            throw new Exception\InvalidTemplatePathException(sprintf(
                '%s expects a valid path to a directory; received "%s"',
                __METHOD__,
                $templatePath
            ));
        }

        if (null !== $namespace && ! is_string($namespace)) {
            throw new Exception\InvalidNamespaceException('Namespace must be a string');
        }

        $namespace = $namespace ?: self::DEFAULT_NAMESPACE;

        $templatePath = rtrim((string) $templatePath, '/\\');
        $this->getTemplatePath($namespace)->push($templatePath);

        return $this;
    }
public function addTemplatePath ( $ templatePath , $ namespace = null ) { if ( ! is_dir ( $ templatePath ) ) { throw new Exception \ InvalidTemplatePathException ( sprintf ( '%s expects a valid path to a directory; received "%s"' , __METHOD__ , $ templatePath ) ) ; } if ( null !== $ namespace && ! is_string ( $ namespace ) ) { throw new Exception \ InvalidNamespaceException ( 'Namespace must be a string' ) ; } $ namespace = $ namespace ? : self :: DEFAULT_NAMESPACE ; $ templatePath = rtrim ( ( string ) $ templatePath , '/\\' ) ; $ this -> getTemplatePath ( $ namespace ) -> push ( $ templatePath ) ; return $ this ; }
Add a template path.

Adds a template path to the internal stack. If a namespace is provided,
the path is added to the stack specific to that namespace; otherwise,
the default namespace is assumed.

@param  string $templatePath
@param  null|string $namespace
@return DefaultResolver
@throws Exception\InvalidTemplatePathException
Add a template path .