<?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
* 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
*/
//* 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
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));
// 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,
} // 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
$this->groups[$groupId]['tag'],
$content
);
- $this->groups[$groupId]['opened'] = FALSE;
+ $this->groups[$groupId]['opened'] = false;
// Mark previous group as closed
$this->setPreviousGroupId('');
// 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;
*/
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
// 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
// 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";
*/
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;