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;
    }