Renamed Registry -> GenericRegistry to make it clear that this registry does
[core.git] / framework / main / classes / helper / html / forms / class_HtmlFormHelper.php
index aee395fb8d8c3023dd9fe34f28d710e3b40695c5..7927b353a084340ca40f8a494c30f00e64c0c7a6 100644 (file)
@@ -1,15 +1,17 @@
 <?php
 // Own namespace
-namespace CoreFramework\Helper;
+namespace Org\Mxchange\CoreFramework\Helper;
 
 // Import framework stuff
-use CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Generic\EmptyVariableException;
-use CoreFramework\Generic\NullPointerException;
-use CoreFramework\Helper\Template\HelpableTemplate;
-use CoreFramework\Registry\Registry;
-use CoreFramework\Template\CompileableTemplate;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+
+// Import SPL stuff
+use \InvalidArgumentException;
 
 /**
  * A helper for constructing web forms
@@ -380,19 +382,16 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $groupText      Text including HTML to show above this group
         * @return      void
         * @throws      FormClosedException             If no form has been opened before
-        * @throws      EmptyVariableException  If $groupId is not set
+        * @throws      InvalidArgumentException        If $groupId is not set
         */
        public function addFormGroup ($groupId = '', $groupText = '') {
                // Is a form opened?
                if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Throw exception here
                        throw new FormClosedException(array($this, $groupId), self::EXCEPTION_CLOSED_FORM);
-               } // END - if
-
-               // At least the group name should be set
-               if ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === false)) {
+               } elseif ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === false)) {
                        // Throw exception here
-                       throw new EmptyVariableException(array($this, 'groupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('Parameter "groupId" is empty but group is not closed');
                } elseif (empty($groupId)) {
                        // Close the last opened
                        $groupId = $this->getPreviousGroupId();
@@ -455,19 +454,16 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $subGroupText   Text including HTML to show above this group
         * @return      void
         * @throws      FormFormClosedException         If no group has been opened before
-        * @throws      EmptyVariableException          If $subGroupId is not set
+        * @throws      InvalidArgumentException                If $subGroupId is not set
         */
        public function addFormSubGroup ($subGroupId = '', $subGroupText = '') {
                // Is a group opened?
                if ($this->ifGroupOpenedPreviously() === false) {
                        // Throw exception here
                        throw new FormFormClosedException(array($this, $subGroupId), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
-               } // END - if
-
-               // At least the sub group name should be set
-               if ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === false)) {
+               } elseif ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === false)) {
                        // Throw exception here
-                       throw new EmptyVariableException(array($this, 'subGroupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('Parameter "subGroupId" is empty but sub-group is not closed');
                } elseif (empty($subGroupId)) {
                        // Close the last opened
                        $subGroupId = $this->getPreviousSubGroupId();
@@ -689,7 +685,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
 
                try {
                        // Get last executed pre filter
-                       $extraInstance = Registry::getRegistry()->getInstance('extra');
+                       $extraInstance = GenericRegistry::getRegistry()->getInstance('extra');
                } catch (NullPointerException $e) {
                        // Instance in registry is not set (NULL)
                        // @TODO We need to log this later