Continued:
[core.git] / framework / main / classes / template / class_BaseTemplateEngine.php
index 67a4baef985229d330a4731484cfe27fb4b959c8..adcfda2626b7113256f96bf1ee70a2c227870bfd 100644 (file)
@@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
@@ -1114,17 +1115,21 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $variableName   The variable we are looking for
         * @param       $value                  The value we want to store in the variable
         * @return      void
+        * @throws      NullPointerException    If $variableName is NULL
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
        public final function assignVariable ($variableName, $value) {
-               // Replace all dashes to underscores to match variables with configuration entries
-               $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
-
-               // Empty variable found?
-               if (empty($variableName)) {
+               // Validate parameter
+               if (is_null($variableName)) {
+                       // Throw NPE
+                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+               } elseif (empty($variableName)) {
                        // Throw an exception
                        throw new InvalidArgumentException('Parameter "variableName" is empty');
-               } // END - if
+               }
+
+               // Replace all dashes to underscores to match variables with configuration entries
+               $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
 
                // First search for the variable if it was already added
                $index = $this->getVariableIndex($variableName);