]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/helper/class_BaseHelper.php
Added new interfaces Handleable/-DataSet and ProtocolHandler (no content yet).
[core.git] / inc / classes / main / helper / class_BaseHelper.php
index 172846a9cea2d3c2faf44ed250bbd6f136620b10..8616a502fbd60487aec3447e4c73c6961d1b593d 100644 (file)
@@ -2,11 +2,11 @@
 /**
  * A generic helper class with generic methods
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @link               http://www.shipsimu.org
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -87,7 +87,7 @@ class BaseHelper extends BaseFrameworkSystem {
         * @return      void
         */
        protected final function addContent ($newContent) {
-               $this->content .= (string) trim($newContent) . chr(10);
+               $this->content .= (string) trim($newContent) . PHP_EOL;
        }
 
        /**
@@ -251,7 +251,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\n",
                        $groupId,
@@ -281,7 +281,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
@@ -307,7 +307,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('');
@@ -338,7 +338,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;
 
@@ -356,7 +356,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
@@ -372,7 +372,8 @@ 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\n", $subGroupId, strlen($content), $this->subGroups[$subGroupId]['tag'], $content);
-               $this->subGroups[$subGroupId]['opened'] = false;
+               $this->subGroups[$subGroupId]['opened'] = FALSE
+               ;
 
                // Mark previous sub group as closed
                $this->setPreviousSubGroupId('');
@@ -391,7 +392,7 @@ class BaseHelper extends BaseFrameworkSystem {
                // Is header content there?
                if (isset($this->groups['header'])) {
                        // Then add it
-                       $content .= $this->groups['header']['content'] . chr(10);
+                       $content .= $this->groups['header']['content'] . PHP_EOL;
                } // END - if
 
                // Initiate content
@@ -400,12 +401,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";
@@ -419,7 +420,7 @@ class BaseHelper extends BaseFrameworkSystem {
                // Is footer content there?
                if (isset($this->groups['footer'])) {
                        // Then add it
-                       $content .= $this->groups['footer']['content'] . chr(10);
+                       $content .= $this->groups['footer']['content'] . PHP_EOL;
                } // END - if
 
                // Return it
@@ -435,7 +436,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;