Renamed Registry -> GenericRegistry to make it clear that this registry does
[core.git] / framework / main / classes / helper / class_BaseHelper.php
index b0948b673255647635fc1834ba26749be5f1a690..625220f718fbca7ec1b19754f9856ff9165f3665 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 // Own namespace
-namespace CoreFramework\Helper;
+namespace Org\Mxchange\CoreFramework\Helper;
 
 // Import framework stuff
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Generic\FrameworkInterface;
-use CoreFramework\Generic\NullPointerException;
-use CoreFramework\Object\BaseFrameworkSystem;
-use CoreFramework\Registry\Registry;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 
 /**
  * A generic helper class with generic methods
@@ -31,7 +31,7 @@ use CoreFramework\Registry\Registry;
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class BaseHelper extends BaseFrameworkSystem {
+abstract class BaseHelper extends BaseFrameworkSystem {
        /**
         * Instance to the class which provides field values
         */
@@ -216,7 +216,7 @@ class BaseHelper extends BaseFrameworkSystem {
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('O:'.$registryKey.'/'.$extraKey);
                try {
                        // Get the required instance
-                       $this->valueInstance = Registry::getRegistry()->getInstance($registryKey);
+                       $this->valueInstance = GenericRegistry::getRegistry()->getInstance($registryKey);
                } catch (NullPointerException $e) {
                        // Not set in registry
                        // @TODO Try to log it here
@@ -227,7 +227,7 @@ class BaseHelper extends BaseFrameworkSystem {
                if (!is_null($extraKey)) {
                        try {
                                // Get the extra instance.
-                               $this->extraInstance = Registry::getRegistry()->getInstance($extraKey);
+                               $this->extraInstance = GenericRegistry::getRegistry()->getInstance($extraKey);
                        } catch (NullPointerException $e) {
                                // Try to create it
                                $this->extraInstance = ObjectFactory::createObjectByConfiguredName($extraKey . '_class', array($this->valueInstance));
@@ -266,7 +266,7 @@ class BaseHelper extends BaseFrameworkSystem {
 
                // Add the group to the stack
                $this->groups[$this->totalCounter] = $groupId;
-               $this->groups[$groupId]['opened']  = TRUE;
+               $this->groups[$groupId]['opened']  = true;
                $this->groups[$groupId]['content'] = sprintf(
                        '<!-- group %s opened (length: %s, tag: %s) //-->%s' . PHP_EOL,
                        $groupId,
@@ -296,7 +296,7 @@ class BaseHelper extends BaseFrameworkSystem {
                } // END - if
 
                // Check if any group was opened before
-               if ($this->ifGroupOpenedPreviously() === FALSE) {
+               if ($this->ifGroupOpenedPreviously() === false) {
                        // Then throw an exception
                        throw new HelperNoPreviousOpenedGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
                } // END - if
@@ -322,7 +322,7 @@ class BaseHelper extends BaseFrameworkSystem {
                        $this->groups[$groupId]['tag'],
                        $content
                );
-               $this->groups[$groupId]['opened'] = FALSE;
+               $this->groups[$groupId]['opened'] = false;
 
                // Mark previous group as closed
                $this->setPreviousGroupId('');
@@ -353,7 +353,7 @@ class BaseHelper extends BaseFrameworkSystem {
 
                // Add the group to the stack
                $this->subGroups[$this->totalCounter] = $subGroupId;
-               $this->subGroups[$subGroupId]['opened']  = TRUE;
+               $this->subGroups[$subGroupId]['opened']  = true;
                $this->subGroups[$subGroupId]['content'] = sprintf("<!-- sub-group %s opened (length: %s, tag: %s) //-->%s\n", $subGroupId, strlen($content), $tag, $content);
                $this->subGroups[$subGroupId]['tag'] = $tag;
 
@@ -371,7 +371,7 @@ class BaseHelper extends BaseFrameworkSystem {
         */
        public function closePreviousSubGroupByContent ($content = '') {
                // Check if any sub group was opened before
-               if ($this->ifSubGroupOpenedPreviously() === FALSE) {
+               if ($this->ifSubGroupOpenedPreviously() === false) {
                        // Then throw an exception
                        throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
                } // END - if
@@ -387,7 +387,7 @@ class BaseHelper extends BaseFrameworkSystem {
 
                // Add content to it and mark it as closed
                $this->subGroups[$subGroupId]['content'] .= sprintf('<!-- sub-group %s closed (length: %s, tag: %s) //-->%s' . PHP_EOL, $subGroupId, strlen($content), $this->subGroups[$subGroupId]['tag'], $content);
-               $this->subGroups[$subGroupId]['opened'] = FALSE
+               $this->subGroups[$subGroupId]['opened'] = false
                ;
 
                // Mark previous sub group as closed
@@ -416,12 +416,12 @@ class BaseHelper extends BaseFrameworkSystem {
                // Now "walk" through all groups and sub-groups
                for ($idx = 1; $idx <= $this->totalCounter; $idx++) {
                        // Is this a sub/group and is it closed?
-                       if ((isset($this->groups[$idx])) && ($this->groups[$this->groups[$idx]]['opened'] === FALSE)) {
+                       if ((isset($this->groups[$idx])) && ($this->groups[$this->groups[$idx]]['opened'] === false)) {
                                // Then add it's content
                                $groupContent = trim($this->groups[$this->groups[$idx]]['content']);
                                //* DEBUG: */ echo "group={$this->groups[$idx]},content=<pre>".htmlentities($groupContent)."</pre><br />\n";
                                $content .= $groupContent;
-                       } elseif ((isset($this->subGroups[$idx])) && ($this->subGroups[$this->subGroups[$idx]]['opened'] === FALSE)) {
+                       } elseif ((isset($this->subGroups[$idx])) && ($this->subGroups[$this->subGroups[$idx]]['opened'] === false)) {
                                // Then add it's content
                                $subGroupContent = $this->subGroups[$this->subGroups[$idx]]['content'];
                                //* DEBUG: */ echo "subgroup={$this->subGroups[$idx]},content=<pre>".htmlentities($subGroupContent)."</pre><br />\n";
@@ -451,7 +451,7 @@ class BaseHelper extends BaseFrameworkSystem {
         */
        protected function ifGroupIsOpened ($groupId) {
                // Is the group open?
-               $isOpened = ((isset($this->groups[$groupId])) && ($this->groups[$groupId]['opened'] === TRUE));
+               $isOpened = ((isset($this->groups[$groupId])) && ($this->groups[$groupId]['opened'] === true));
 
                // Return status
                return $isOpened;