Continued:
[core.git] / framework / main / classes / helper / html / blocks / class_HtmlBlockHelper.php
index ac4c008aef1d99dd2c27ea1877cf77d0c565bae9..dc7f7ca6204c75b76f709252002f17b391e28e50 100644 (file)
@@ -3,6 +3,7 @@
 namespace Org\Mxchange\CoreFramework\Helper;
 
 // Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
 use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
 
@@ -11,7 +12,7 @@ use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -39,7 +40,7 @@ class HtmlBlockHelper extends BaseHtmlHelper implements HelpableTemplate {
         *
         * @return      void
         */
-       protected function __construct () {
+       private function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
        }
@@ -51,7 +52,7 @@ class HtmlBlockHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $blockName                      Name of the block we shall generate
         * @return      $helperInstance         A prepared instance of this helper
         */
-       public static final function createHtmlBlockHelper (CompileableTemplate $templateInstance, $blockName) {
+       public static final function createHtmlBlockHelper (CompileableTemplate $templateInstance, string $blockName) {
                // Get new instance
                $helperInstance = new HtmlBlockHelper();
 
@@ -71,8 +72,8 @@ class HtmlBlockHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $blockName      Name of the block we shall generate
         * @return      void
         */
-       protected final function setBlockName ($blockName) {
-               $this->blockName = (string) $blockName;
+       protected final function setBlockName (string $blockName) {
+               $this->blockName = $blockName;
        }
 
        /**
@@ -90,7 +91,7 @@ class HtmlBlockHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $withRegistration       Whether with registration date
         */
        public function ifIncludeRegistrationStamp () {
-               $withRegistration = ($this->getConfigInstance()->getConfigEntry('block_shows_registration') == 'Y');
+               $withRegistration = FrameworkBootstrap::getConfigurationInstance()->isEnabled('block_shows_registration');
                return $withRegistration;
        }
 
@@ -101,9 +102,9 @@ class HtmlBlockHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $messageId                      Message id to load an assign
         * @return      void
         */
-       public function assignMessageField ($templateVariable, $messageId) {
+       public function assignMessageField (string $templateVariable, string $messageId) {
                // Get message
-               $message = $this->getLanguageInstance()->getMessage($messageId);
+               $message = FrameworkBootstrap::getLanguageInstance()->getMessage($messageId);
 
                // And assign it
                $this->getTemplateInstance()->assignVariable($templateVariable, $message);
@@ -116,7 +117,7 @@ class HtmlBlockHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $actionValue    Action value to assign
         * @return      void
         */
-       public function assignLinkFieldWithAction ($linkField, $actionValue) {
+       public function assignLinkFieldWithAction (string $linkField, $actionValue) {
                $this->getTemplateInstance()->assignVariable($linkField . '_action', $actionValue);
        }
 
@@ -126,12 +127,12 @@ class HtmlBlockHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $userStatus             Raw user status from database layer
         * @return      $translated             Translated user status
         */
-       protected function doFilterUserStatusTranslator ($userStatus) {
+       protected function doFilterUserStatusTranslator (string $userStatus) {
                // Generate message id
-               $messageId = 'user_status_' . strtolower($userStatus);
+               $messageId = sprintf('user_status_%s', strtolower($userStatus));
 
                // Get that message
-               $translated = $this->getLanguageInstance()->getMessage($messageId);
+               $translated = FrameworkBootstrap::getLanguageInstance()->getMessage($messageId);
 
                // Return it
                return $translated;