]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/helper/class_BaseHelper.php
Continued:
[core.git] / framework / main / classes / helper / class_BaseHelper.php
index 5c6ab7520d910245e58098f4d34cdec48dde0050..f32b3618a4cf4e4bd118a7b62676b3164f530e3f 100644 (file)
@@ -91,7 +91,11 @@ abstract class BaseHelper extends BaseFrameworkSystem {
         */
        protected function __construct (string $className) {
                // Call parent constructor
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-HELPER: className=%s - CONSTRUCTED!', $className));
                parent::__construct($className);
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-HELPER: EXIT!');
        }
 
        /**
@@ -99,9 +103,21 @@ abstract class BaseHelper extends BaseFrameworkSystem {
         *
         * @param       $newContent             New content to add
         * @return      void
+        * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
        protected final function addContent (string $newContent) {
+               // Check variable
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-HELPER: newContent=%s - CALLED!', $newContent));
+               if (empty(trim($newContent))) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "newContent" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+               }
+
+               // Append content with EOL
                $this->content .= trim($newContent) . PHP_EOL;
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-HELPER: this->content()=%d - EXIT!', strlen($this->content)));
        }
 
        /**
@@ -109,10 +125,21 @@ abstract class BaseHelper extends BaseFrameworkSystem {
         *
         * @param       $content        Content to to the base
         * @return      void
+        * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
        protected function addHeaderContent (string $content) {
+               // Check variable
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-HELPER: content=%s - CALLED!', $content));
+               if (empty(trim($content))) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "content" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+               }
+
                // Add the header content
                $this->groups['header']['content'] = trim($content);
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-HELPER: EXIT!');
        }
 
        /**
@@ -120,10 +147,21 @@ abstract class BaseHelper extends BaseFrameworkSystem {
         *
         * @param       $content        Content to to the base
         * @return      void
+        * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
        protected function addFooterContent (string $content) {
+               // Check variable
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-HELPER: content=%s - CALLED!', $content));
+               if (empty(trim($content))) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "content" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
+               }
+
                // Add the footer content
                $this->groups['footer']['content'] = trim($content);
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-HELPER: EXIT!');
        }
 
        /**