From 4e96b065084227f1835e01ef24a9957581daed70 Mon Sep 17 00:00:00 2001 From: Moreno Feltscher Date: Thu, 9 Apr 2015 09:58:37 +0200 Subject: [PATCH] Throwing exception if template directories are not defined --- Templating/Renderer.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Templating/Renderer.php b/Templating/Renderer.php index adecbd0..3d381d7 100644 --- a/Templating/Renderer.php +++ b/Templating/Renderer.php @@ -31,6 +31,8 @@ class Renderer * @param string $fileExtension File extension for Handlebar files * @param array $templateDirectories List of directories containing handlebars templates * @param boolean $templateDirectoriesRecursive Whether to include sub directories of template directories + * + * @throws \InvalidArgumentException If no template directories got defined. */ public function __construct( FileLocator $fileLocator, @@ -38,6 +40,9 @@ public function __construct( array $templateDirectories, $templateDirectoriesRecursive = true ) { + if (empty($templateDirectories)) { + throw new \InvalidArgumentException('No Handlebars template directories got defined in "smartive_handlebars.templating.template_directories".'); + } $this->fileLocator = $fileLocator; if ($templateDirectoriesRecursive) { $templateDirectories = $this->getTemplateDirectoriesRecursive($templateDirectories);