<?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\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
* @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();
* @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();
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