public function registerTemplate(TemplateInterface $template)
    {
        $templateName = $template->getName();
        $parts = explode('/', $templateName);

        if (count($parts) !== 2) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Template name "%s" is not formatted properly, should be like "domain/template-name"',
                    $templateName
                )
            );
        }

        list($domain, $name) = $parts;

        $this->templates[$domain][$name] = $template;
    }