]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 21 Aug 2025 19:33:22 +0000 (21:33 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 21 Aug 2025 20:31:15 +0000 (22:31 +0200)
- added more type-hints (hopefully correct)
- variable `$found` is an integer and should be initialized with an invalid value

17 files changed:
framework/config/class_FrameworkConfiguration.php
framework/main/classes/class_
framework/main/classes/class_Base
framework/main/classes/decorator/xml/template/class_XmlRewriterTemplateDecorator.php
framework/main/classes/streams/class_
framework/main/classes/streams/class_BaseStream.php
framework/main/classes/streams/crypto/null/class_NullCryptoStream.php
framework/main/classes/streams/crypto/openssl/class_OpenSslStream.php
framework/main/classes/streams/input/class_
framework/main/classes/streams/output/class_
framework/main/classes/template/class_BaseTemplateEngine.php
framework/main/classes/template/menu/class_MenuTemplateEngine.php
framework/main/classes/utils/arrays/class_ArrayUtils.php
framework/main/classes/utils/crypto/class_CryptoUtils.php
framework/main/classes/utils/numbers/class_NumberUtils.php
framework/main/classes/utils/strings/class_StringUtils.php
framework/main/interfaces/template/class_CompileableTemplate.php

index 4c1aec09b7a9187db84e7f10a7f1d00baf21fe72..257eede25f7e505071edfbaa2e9f9172214494a7 100644 (file)
@@ -84,7 +84,7 @@ class FrameworkConfiguration implements Registerable {
         * @return      $isset  Whether the given configuration key is set
         * @throws      InvalidArgumentException        If $configKey is empty
         */
-       public function isConfigurationEntrySet (string $configKey) {
+       public function isConfigurationEntrySet (string $configKey): bool {
                // Is it null?
                //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $configKey);
                if (empty($configKey)) {
@@ -108,7 +108,7 @@ class FrameworkConfiguration implements Registerable {
         * @throws      InvalidArgumentException        If $configKey is empty
         * @throws      NoConfigEntryException          If a configuration element was not found
         */
-       public function getConfigEntry (string $configKey) {
+       public function getConfigEntry (string $configKey): mixed {
                // Is it null?
                //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $configKey);
                if (empty($configKey)) {
@@ -140,7 +140,7 @@ class FrameworkConfiguration implements Registerable {
         * @throws      InvalidArgumentException        If $configKey is empty
         * @throws      InvalidArgumentException        If $configValue has an unsupported variable type
         */
-       public final function setConfigEntry (string $configKey, $configValue) {
+       public final function setConfigEntry (string $configKey, mixed $configValue): void {
                // Is a valid configuration key key provided?
                //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s,configValue[]=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $configKey, gettype($configValue));
                if (empty($configKey)) {
@@ -195,7 +195,7 @@ class FrameworkConfiguration implements Registerable {
         * @throws      InvalidArgumentException        If $configKey is empty
         * @throws      NoConfigEntryException  If a configuration element was not found
         */
-       public final function unsetConfigEntry (string $configKey) {
+       public final function unsetConfigEntry (string $configKey): void {
                // Validate parameters
                //* NOISY-DEBUG: */ printf('[%s:%d]: configKey=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $configKey);
                if (empty($configKey)) {
@@ -229,7 +229,7 @@ class FrameworkConfiguration implements Registerable {
         * @throws      InvalidArgumentException        If a parameter is invalid
         * @throws      UnexpectedValueException        If a returned value is of an unexpected type or value
         */
-       public function isEnabled (string $keyPart) {
+       public function isEnabled (string $keyPart): bool {
                // Validate parameters
                //* NOISY-DEBUG: */ printf('[%s:%d]: keyPart=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $keyPart);
                if (empty($keyPart)) {
@@ -272,7 +272,7 @@ class FrameworkConfiguration implements Registerable {
         * @param       $objectInstance         An instance of a FrameworkInterface object
         * @return      $equals                         Whether both objects equals
         */
-       public function equals (FrameworkInterface $objectInstance) {
+       public function equals (FrameworkInterface $objectInstance): bool {
                // Now test it
                $equals = ((
                                $this->__toString() === $objectInstance->__toString()
@@ -290,7 +290,7 @@ class FrameworkConfiguration implements Registerable {
         * @param       $callbackInstance       An instance of a FrameworkInterface class
         * @return      void
         */
-       public function setCallbackInstance (FrameworkInterface $callbackInstance) {
+       public function setCallbackInstance (FrameworkInterface $callbackInstance): void {
                $this->callbackInstance = $callbackInstance;
        }
 
@@ -301,7 +301,7 @@ class FrameworkConfiguration implements Registerable {
         * @return      $fieldValue             Field value from the user
         * @throws      NullPointerException    If the result instance is null
         */
-       public final function getField (string $fieldName) {
+       public final function getField (string $fieldName): mixed {
                // The super interface "FrameworkInterface" requires this
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
@@ -313,7 +313,7 @@ class FrameworkConfiguration implements Registerable {
         * @return      $isSet          Whether the given field name is set
         * @throws      NullPointerException    If the result instance is null
         */
-       public function isFieldSet (string $fieldName) {
+       public function isFieldSet (string $fieldName): bool {
                // The super interface "FrameworkInterface" requires this
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
index c2700e48871bd085e3ae5ce9d2591ff41b23326d..700287cc3ab071a6f73f9c376c3d07341360021b 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ???!!! extends Base!!! implements CompileableTemplate {
+class ???!!! extends Base!!! implements !!! {
        /**
         * Protected constructor
         *
@@ -38,7 +38,7 @@ class ???!!! extends Base!!! implements CompileableTemplate {
         * @param       $appInstance    A manageable application
         * @return      $///Instance    An instance of this !!! class
         */
-       public final static function create???!!! (ManageableApplication $appInstance) {
+       public final static function create???!!! (ManageableApplication $appInstance): !!! {
                // Get a new instance
                $///Instance = new ???!!!();
 
index 2741ceeac6ee423ac81002fd314f6513283570fa..7c0e07b3622da62cbbb94136b6016eb2273a71cd 100644 (file)
@@ -28,7 +28,7 @@ abstract class Base??? extends BaseFrameworkSystem {
         * @param       $className      Name of the class
         * @return      void
         */
-       protected function __construct ($className) {
+       protected function __construct (string $className) {
                // Call parent constructor
                parent::__construct($className);
        }
index d2666c5288d626de1785b63e97a15830d762b8b2..f0d606157d448fe66d5a1d292bd77cee94a879b0 100644 (file)
@@ -54,7 +54,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         * @param       $innerTemplateInstance  A CompileableXmlTemplate instance
         * @return      $templateInstance       An instance of TemplateEngine
         */
-       public static final function createXmlRewriterTemplateDecorator (CompileableXmlTemplate $innerTemplateInstance) {
+       public static final function createXmlRewriterTemplateDecorator (CompileableXmlTemplate $innerTemplateInstance): CompileableXmlTemplate {
                // Get a new instance
                $templateInstance = new XmlRewriterTemplateDecorator();
 
@@ -72,7 +72,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         * @param       $add            Whether add this group
         * @return      void
         */
-       public function setVariableGroup (string $groupName, bool $add = true) {
+       public function setVariableGroup (string $groupName, bool $add = true): void {
                // Call the inner class' method
                $this->getTemplateInstance()->setVariableGroup($groupName, $add);
        }
@@ -84,7 +84,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         * @param       $value  Value to store in variable
         * @return      void
         */
-       public function addGroupVariable (string $variableName, $value) {
+       public function addGroupVariable (string $variableName, mixed $value): void {
                // Call the inner class' method
                $this->getTemplateInstance()->addGroupVariable($variableName, $value);
        }
@@ -94,7 +94,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *
         * @return      $templateBasePath       The relative base path for all templates
         */
-       public final function getTemplateBasePath () {
+       public final function getTemplateBasePath (): string {
                // Call the inner class' method
                return $this->getTemplateInstance()->getTemplateBasePath();
        }
@@ -104,7 +104,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *
         * @return      $templateBasePath       The relative base path for all templates
         */
-       public final function getGenericBasePath () {
+       public final function getGenericBasePath (): string {
                // Call the inner class' method
                return $this->getTemplateInstance()->getGenericBasePath();
        }
@@ -114,7 +114,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *
         * @return      $templateExtension      The file extension for all uncompiled templates
         */
-       public final function getRawTemplateExtension () {
+       public final function getRawTemplateExtension (): string {
                // Call the inner class' method
                return $this->getTemplateInstance()->getRawTemplateExtension();
        }
@@ -125,7 +125,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         * @param       $variableGroup  Variable group to check
         * @return      $varStack               Found variable group
         */
-       public function getVarStack (string $variableGroup) {
+       public function getVarStack (string $variableGroup): array {
                // Call the inner class' method
                return $this->getTemplateInstance()->getVarStack($variableGroup);
        }
@@ -135,7 +135,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *
         * @return      $codeExtension  The file extension for all code templates
         */
-       public final function getCodeTemplateExtension () {
+       public final function getCodeTemplateExtension (): string {
                // Call the inner class' method
                return $this->getTemplateInstance()->getCodeTemplateExtension();
        }
@@ -145,7 +145,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *
         * @return      $templateType   The current template's type
         */
-       public final function getTemplateType () {
+       public final function getTemplateType (): string {
                // Call the inner class' method
                return $this->getTemplateInstance()->getTemplateType();
        }
@@ -157,7 +157,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         * @param       $value  The value we want to store in the variable
         * @return      void
         */
-       public function assignVariable (string $variableName, $value) {
+       public function assignVariable (string $variableName, mixed $value): void {
                // Call the inner class' method
                $this->getTemplateInstance()->assignVariable($variableName, $value);
        }
@@ -169,7 +169,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         * @param       $variableGroup  Name of variable group (default: 'general')
         * @return      void
         */
-       public function removeVariable (string $variableName, string $variableGroup = 'general') {
+       public function removeVariable (string $variableName, string $variableGroup = 'general'): void {
                // Call the inner class' method
                $this->getTemplateInstance()->removeVariable($variableName, $variableGroup);
        }
@@ -181,7 +181,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *                                              'html' by default
         * @return      void
         */
-       public function loadHtmlTemplate (string $template) {
+       public function loadHtmlTemplate (string $template): void {
                // Call the inner class' method
                $this->getTemplateInstance()->loadHtmlTemplate($template);
        }
@@ -192,7 +192,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         * @param       $variableName   The configuration variable we want to assign
         * @return      void
         */
-       public function assignConfigVariable (string $variableName) {
+       public function assignConfigVariable (string $variableName): void {
                // Call the inner class' method
                $this->getTemplateInstance()->assignConfigVariable($variableName);
        }
@@ -204,7 +204,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *                                              located in 'code' by default
         * @return      void
         */
-       public function loadCodeTemplate (string $template) {
+       public function loadCodeTemplate (string $template): void {
                // Call the inner class' method
                $this->getTemplateInstance()->loadCodeTemplate($template);
        }
@@ -217,7 +217,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *                                              located in "html" by default
         * @return      void
         */
-       public function loadEmailTemplate ($template) {
+       public function loadEmailTemplate (string $template): void {
                // Call the inner class' method
                $this->getTemplateInstance()->loadEmailTemplate($template);
        }
@@ -229,7 +229,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *
         * @return      void
         */
-       public function compileConfigInVariables () {
+       public function compileConfigInVariables (): void {
                // Call the inner class' method
                $this->getTemplateInstance()->compileConfigInVariables();
        }
@@ -239,7 +239,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *
         * @return      void
         */
-       public function compileVariables () {
+       public function compileVariables (): void {
                // Call the inner class' method
                $this->getTemplateInstance()->compileVariables();
        }
@@ -249,7 +249,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *
         * @return      void
         */
-       public function compileTemplate () {
+       public function compileTemplate (): void {
                // Call the inner class' method
                $this->getTemplateInstance()->compileTemplate();
        }
@@ -261,7 +261,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         * @param       $variableName   Name of the variable we want to assign
         * @return      void
         */
-       public function assignTemplateWithVariable (string $templateName, string $variableName) {
+       public function assignTemplateWithVariable (string $templateName, string $variableName): void {
                // Call the inner class' method
                $this->getTemplateInstance()->assignTemplateWithVariable($templateName, $variableName);
        }
@@ -272,7 +272,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         * @param       $responseInstance       An instance of a Responseable class
         * @return      void
         */
-       public function transferToResponse (Responseable $responseInstance) {
+       public function transferToResponse (Responseable $responseInstance): void {
                // Call the inner class' method
                $this->getTemplateInstance()->transportToResponse($responseInstance);
        }
@@ -282,7 +282,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *
         * @return      void
         */
-       public function assignApplicationData () {
+       public function assignApplicationData (): void {
                // Call the inner class' method
                $this->getTemplateInstance()->assignApplicationData();
        }
@@ -294,7 +294,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         * @param       $setMatchAsCode         Sets $match if readVariable() returns empty result
         * @return      $rawCode                        Compile code with inserted variable value
         */
-       public function compileRawCode (string $rawCode, bool $setMatchAsCode = false) {
+       public function compileRawCode (string $rawCode, bool $setMatchAsCode = false): string {
                return $this->getTemplateInstance()->compileRawCode($rawCode, $setMatchAsCode);
        }
 
@@ -303,7 +303,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *
         * @return      $variableGroups         All variable groups
         */
-       public final function getVariableGroups () {
+       public final function getVariableGroups (): array {
                // Call the inner class' method
                return $this->getTemplateInstance()->getVariableGroups();
        }
@@ -313,7 +313,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         *
         * @return      $rawTemplateData        The raw data from the template
         */
-       public function getRawTemplateData () {
+       public function getRawTemplateData (): string {
                // Call the inner class' method
                return $this->getTemplateInstance()->getRawTemplateData();
        }
@@ -325,7 +325,7 @@ class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableX
         * @param       $newName        New name of variable
         * @return      void
         */
-       public function renameVariable (string $oldName, string $newName) {
+       public function renameVariable (string $oldName, string $newName): void {
                // Call the inner class' method
                $this->getTemplateInstance()->renameVariable($oldName, $newName);
        }
index 623e73157e489550cdffa8d8604cc1b3048e27a7..14859df76ef65244c35f32e6323431281f0bd0bb 100644 (file)
@@ -45,7 +45,7 @@ class ???Stream extends BaseStream implements Stream {
         *
         * @return      $streamInstance         An instance of this node class
         */
-       public final static function create???Stream (Requestable $requestInstance) {
+       public final static function create???Stream (Requestable $requestInstance): Stream {
                // Get a new instance
                $streamInstance = new ???Stream();
 
@@ -60,9 +60,9 @@ class ???Stream extends BaseStream implements Stream {
         * @return      $data   The data (string mostly) to "stream"
         * @throws      UnsupportedOperationException   If this method is called
         */
-       public function streamData ($data) {
+       public function streamData ($data): mixed {
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.');
-               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
+               throw new UnsupportedOperationException([$this, __FUNCTION__], self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
 }
index 53bd4ed8ca86746d48936df0bcf558e42a722a12..993d10f62f7a46c2babc96f9da0a23857783e036 100644 (file)
@@ -27,7 +27,7 @@ use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-abstract class BaseStream extends BaseFrameworkSystem {
+abstract class BaseStream extends BaseFrameworkSystem implements Stream {
        /**
         * Protected constructor
         *
index 9c950ef23e2d084dc93e905b6e11fb0d6da0a250..2f79b5080fde58226ca0db9ee4430f57198cabf1 100644 (file)
@@ -47,7 +47,7 @@ class NullCryptoStream extends BaseCryptoStream implements EncryptableStream {
         *
         * @return      $streamInstance         An instance of this node class
         */
-       public static final function createNullCryptoStream () {
+       public static final function createNullCryptoStream (): EncryptableStream {
                // Get a new instance
                $streamInstance = new NullCryptoStream();
 
@@ -62,7 +62,7 @@ class NullCryptoStream extends BaseCryptoStream implements EncryptableStream {
         * @param       $key            Ignored
         * @return      $encrypted      Encrypted string
         */
-       public function encryptStream (string $str, string $key = NULL) {
+       public function encryptStream (string $str, string $key = NULL): string {
                // Return it
                return $str;
        }
@@ -74,7 +74,7 @@ class NullCryptoStream extends BaseCryptoStream implements EncryptableStream {
         * @param       $key            Ignored
         * @return      $str            The unencrypted string
         */
-       public function decryptStream (string $encrypted, string $key = NULL) {
+       public function decryptStream (string $encrypted, string $key = NULL): string {
                // Return it
                return $encrypted;
        }
@@ -86,7 +86,7 @@ class NullCryptoStream extends BaseCryptoStream implements EncryptableStream {
         * @return      $data   The data (string mostly) to "stream"
         * @throws      UnsupportedOperationException   If this method is called (which is a mistake)
         */
-       public function streamData (string $data) {
+       public function streamData (string $data): mixed {
                self::createDebugInstance(__CLASS__, __LINE__)->warningMessage('Unhandled ' . strlen($data) . ' bytes in this stream.');
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
index bcc56ce89fcb2d141218ec19ad59daf130f5ab9c..9f048b8130eae2eb0aa97fbda496bfc4a0e79472 100644 (file)
@@ -48,7 +48,7 @@ class OpenSslStream extends BaseCryptoStream implements EncryptableStream {
         * @param       $rngInstance            An RNG instance
         * @return      $streamInstance         An instance of this node class
         */
-       public static final function createOpenSslStream (RandomNumberGenerator $rngInstance) {
+       public static final function createOpenSslStream (RandomNumberGenerator $rngInstance): EncryptableStream {
                // Get a new instance
                $streamInstance = new OpenSslStream();
 
@@ -66,7 +66,7 @@ class OpenSslStream extends BaseCryptoStream implements EncryptableStream {
         * @param       $key            Optional key, if none provided, a random key will be generated
         * @return      $encrypted      Encrypted string
         */
-       public function encryptStream (string $str, string $key = NULL) {
+       public function encryptStream (string $str, string $key = NULL): string {
                // @TODO unfinished
                return $str;
 
@@ -136,7 +136,7 @@ class OpenSslStream extends BaseCryptoStream implements EncryptableStream {
         * @param       $key            Optional key, if none provided, a random key will be generated
         * @return      $str            The unencrypted string
         */
-       public function decryptStream (string $encrypted, string $key = NULL) {
+       public function decryptStream (string $encrypted, string $key = NULL): string {
                // @TODO unfinished
                return $encrypted;
 
@@ -176,7 +176,7 @@ class OpenSslStream extends BaseCryptoStream implements EncryptableStream {
         * @return      $data   The data (string mostly) to "stream"
         * @throws      UnsupportedOperationException   If this method is called (which is a mistake)
         */
-       public function streamData (string $data) {
+       public function streamData (string $data): mixed {
                self::createDebugInstance(__CLASS__, __LINE__)->warningMessage('Unhandled ' . strlen($data) . ' bytes in this stream.');
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
index 41e9f177b68440c00612a5bf566d1887e1ba8cce..11ee8d668300715d6a9fcdeb53eccdab77f5152a 100644 (file)
@@ -44,7 +44,7 @@ class ???InputStream extends BaseStream implements InputStream {
         *
         * @return      $streamInstance         An instance of this node class
         */
-       public final static function create???InputStream () {
+       public final static function create???InputStream (): InputStream {
                // Get a new instance
                $streamInstance = new ???InputStream();
 
@@ -59,7 +59,7 @@ class ???InputStream extends BaseStream implements InputStream {
         * @return      $data   The data (string mostly) to "stream"
         * @throws      UnsupportedOperationException   If this method is called
         */
-       public function streamData ($data) {
+       public function streamData ($data): mixed {
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.');
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
index 8b50864b71ce66c75f53bcdcc7de4b7b8e1063c8..299bd39b68335e30bd4acd25578f7c392b0ec599 100644 (file)
@@ -44,7 +44,7 @@ class ???OutputStream extends BaseStream implements OutputStream {
         *
         * @return      $streamInstance         An instance of this node class
         */
-       public final static function create???OutputStream () {
+       public final static function create???OutputStream (): OutputStream {
                // Get a new instance
                $streamInstance = new ???OutputStream();
 
@@ -59,7 +59,7 @@ class ???OutputStream extends BaseStream implements OutputStream {
         * @return      $data   The data (string mostly) to "stream"
         * @throws      UnsupportedOperationException   If this method is called
         */
-       public function streamData ($data) {
+       public function streamData ($data): mixed {
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.');
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
index e854c1726b81ac013b9345487ab2dd5c7a1f015a..cf27c1b33136463ccf9a70aa0639871c6809d364 100644 (file)
@@ -10,6 +10,7 @@ use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
+use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
 use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 use Org\Mxchange\CoreFramework\Response\Responseable;
@@ -209,14 +210,14 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $variableGroup  Optional variable group to look in
         * @return      $index                  false means not found, >=0 means found on a specific index
         */
-       private function getVariableIndex (string $variableName, string $variableGroup = NULL) {
+       private function getVariableIndex (string $variableName, string $variableGroup = NULL): int {
                // Replace all dashes to underscores to match variables with configuration entries
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableName=%s,variableGroup[%s]=%s - CALLED!', $variableName, gettype($variableGroup), $variableGroup));
                $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
 
                // First everything is not found
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-TEMPLATE: variableName=%s', $variableName));
-               $found = false;
+               $found = -1;
 
                // If the stack is NULL, use the current group
                if (is_null($variableGroup)) {
@@ -253,7 +254,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      $isSet                  Whether the given variable group is set
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       protected final function isVarStackSet (string $variableGroup) {
+       protected final function isVarStackSet (string $variableGroup): bool {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableGroup=%s - CALLED!', $variableGroup));
                if (empty($variableGroup)) {
@@ -276,7 +277,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      $varStack               Found variable group
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public final function getVarStack (string $variableGroup) {
+       public final function getVarStack (string $variableGroup): array {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableGroup=%s - CALLED!', $variableGroup));
                if (empty($variableGroup)) {
@@ -297,7 +298,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       protected final function setVarStack (string $variableGroup, array $varStack) {
+       protected final function setVarStack (string $variableGroup, array $varStack): void {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableGroup=%s,varStack()=%d - CALLED!', $variableGroup, count($varStack)));
                if (empty($variableGroup)) {
@@ -317,10 +318,10 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @param       $variableName   The variable we are looking for
         * @param       $variableGroup  Optional variable group to look in
-        * @return      $content                Content of the variable or null if not found
+        * @return      $value          Value of the variable or null if not found
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       protected function readVariable (string $variableName, string $variableGroup = NULL) {
+       protected function readVariable (string $variableName, string $variableGroup = NULL): mixed {
                // Check parameters
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableName=%s,variableGroup[%s]=%s - CALLED!', $variableName, gettype($variableGroup), $variableGroup));
                if (empty($variableName)) {
@@ -336,7 +337,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
 
                // First everything is not found
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-TEMPLATE: variableName=%s', $variableName));
-               $content = NULL;
+               $value = NULL;
 
                // If the stack is NULL, use the current group
                if (is_null($variableGroup)) {
@@ -353,12 +354,12 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
                if ($found !== false) {
                        // Read it
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: Invoking this->getVariableValue(%s,%s) ...', $variableGroup, $found));
-                       $content = $this->getVariableValue($variableGroup, $found);
+                       $value = $this->getVariableValue($variableGroup, $found);
                }
 
-               // Return the current position
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: content()=%d - EXIT!', strlen($content)));
-               return $content;
+               // Return variable's value
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: value[]=%s - EXIT!', gettype($value)));
+               return $value;
        }
 
        /**
@@ -368,7 +369,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $value                  Value we want to store in the variable
         * @return      void
         */
-       private function addVariable (string $variableName, $value) {
+       private function addVariable (string $variableName, mixed $value): void {
                // Set general variable group
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableName=%s,value[]=%s - CALLED!', $variableName, gettype($value)));
                $this->setVariableGroup('general');
@@ -386,7 +387,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      $result         Whether array of found variables or empty array
         */
-       private function readCurrentGroup () {
+       private function readCurrentGroup (): array {
                // Default is not found
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-TEMPLATE: CALLED!');
                $result = [];
@@ -412,7 +413,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public function setVariableGroup (string $groupName, bool $add = true) {
+       public function setVariableGroup (string $groupName, bool $add = true): void {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: groupName=%s,add=%d - CALLED!', $groupName, intval($add)));
                if (empty($groupName)) {
@@ -442,7 +443,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public function addGroupVariable (string $variableName, $value) {
+       public function addGroupVariable (string $variableName, mixed $value): void {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableName=%s,value[]=%s - CALLED!', $variableName, gettype($value)));
                if (empty($variableName)) {
@@ -480,7 +481,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $index  Index in variable array
         * @return      $value  Value to set
         */
-       private function getVariableValue (string $variableGroup, int $index) {
+       private function getVariableValue (string $variableGroup, int $index): mixed {
                // Return it
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableGroup=%s,index[]=%d - CALLED!', $variableGroup, $index));
                $value = $this->varStack[$variableGroup][$index]['value'];
@@ -497,7 +498,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $value                  The value we want to store in the variable
         * @return      void
         */
-       private function modifyVariable (string $variableName, $value) {
+       private function modifyVariable (string $variableName, mixed $value): void {
                // Replace all dashes to underscores to match variables with configuration entries
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableName=%s,value[]=%s - CALLED!', $variableName, gettype($value)));
                $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
@@ -522,7 +523,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $value          Value to set
         * @return      void
         */
-       private function setVariableValue (string $variableGroup, int $index, $value) {
+       private function setVariableValue (string $variableGroup, int $index, mixed $value): void {
                // Set variable
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableGroup=%s,index[]=%d,value[]=%s - CALLED!', $variableGroup, $index, gettype($value)));
                $this->varStack[$variableGroup][$index]['value'] = $value;
@@ -542,7 +543,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       protected function setVariable (string $variableGroup, string $variableName, $value) {
+       protected function setVariable (string $variableGroup, string $variableName, mixed $value): void {
                // Check parameters
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableGroup=%s,variableName=%s,value[]=%s - CALLED!', $variableGroup, $variableName, gettype($value)));
                if (empty($variableGroup)) {
@@ -591,7 +592,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $value                  Value to set
         * @return      $varData                Variable data array
         */
-       private function generateVariableArray (string $variableName, $value) {
+       private function generateVariableArray (string $variableName, mixed $value): array {
                // Replace all dashes to underscores to match variables with configuration entries
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableName=%s,value[]=%s - CALLED!', $variableName, gettype($value)));
                $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
@@ -614,7 +615,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $templateType   The current template's type
         * @return      void
         */
-       protected final function setTemplateType (string $templateType) {
+       protected final function setTemplateType (string $templateType): void {
                $this->templateType = $templateType;
        }
 
@@ -623,7 +624,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      $templateType   The current template's type
         */
-       public final function getTemplateType () {
+       public final function getTemplateType (): string {
                return $this->templateType;
        }
 
@@ -633,7 +634,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $template       The last loaded template
         * @return      void
         */
-       private function setLastTemplate (SplFileInfo $fileInstance) {
+       private function setLastTemplate (SplFileInfo $fileInstance): void {
                $this->lastTemplate = $fileInstance;
        }
 
@@ -642,7 +643,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      $template       The last loaded template
         */
-       private function getLastTemplate () {
+       private function getLastTemplate (): SplFileInfo {
                return $this->lastTemplate;
        }
 
@@ -652,7 +653,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param               $templateBasePath               The relative base path for all templates
         * @return      void
         */
-       protected final function setTemplateBasePath (string $templateBasePath) {
+       protected final function setTemplateBasePath (string $templateBasePath): void {
                // And set it
                $this->templateBasePath = $templateBasePath;
        }
@@ -662,7 +663,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      $templateBasePath               The relative base path for all templates
         */
-       public final function getTemplateBasePath () {
+       public final function getTemplateBasePath (): string {
                // And set it
                return $this->templateBasePath;
        }
@@ -672,7 +673,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      $templateBasePath               The relative base path for all templates
         */
-       public final function getGenericBasePath () {
+       public final function getGenericBasePath (): string {
                // And set it
                return $this->genericBasePath;
        }
@@ -684,7 +685,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                                      templates
         * @return      void
         */
-       protected final function setRawTemplateExtension (string $templateExtension) {
+       protected final function setRawTemplateExtension (string $templateExtension): void {
                // And set it
                $this->templateExtension = $templateExtension;
        }
@@ -696,7 +697,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                                      templates
         * @return      void
         */
-       protected final function setCodeTemplateExtension (string $codeExtension) {
+       protected final function setCodeTemplateExtension (string $codeExtension): void {
                // And set it
                $this->codeExtension = $codeExtension;
        }
@@ -707,7 +708,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      $templateExtension      The file extension for all uncompiled
         *                                                      templates
         */
-       public final function getRawTemplateExtension () {
+       public final function getRawTemplateExtension (): string {
                // And set it
                return $this->templateExtension;
        }
@@ -718,7 +719,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      $codeExtension          The file extension for all code-
         *                                                      templates
         */
-       public final function getCodeTemplateExtension () {
+       public final function getCodeTemplateExtension (): string {
                // And set it
                return $this->codeExtension;
        }
@@ -730,7 +731,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                                              templates
         * @return      void
         */
-       protected final function setCompileOutputPath (string $compileOutputPath) {
+       protected final function setCompileOutputPath (string $compileOutputPath): void {
                // And set it
                $this->compileOutputPath = $compileOutputPath;
        }
@@ -744,7 +745,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @throws      InvalidArgumentException        If the variable name is left empty
         * @throws      BadMethodCallException  If this method was called but combination of variableGroup/index isn't found
         */
-       protected final function unsetVariableStackOffset (int $index, string $variableGroup = NULL) {
+       protected final function unsetVariableStackOffset (int $index, string $variableGroup = NULL): void {
                // Check variables
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: index=%d,variableGroup[%s]=%s - CALLED!', $index, gettype($variableGroup), $variableGroup));
                if ($index < 0) {
@@ -783,7 +784,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $rawTemplateData        The raw data from the template
         * @return      void
         */
-       protected final function setRawTemplateData (string $rawTemplateData) {
+       protected final function setRawTemplateData (string $rawTemplateData): void {
                // And store it in this class
                $this->rawTemplateData = $rawTemplateData;
        }
@@ -793,7 +794,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      $rawTemplateData        The raw data from the template
         */
-       public final function getRawTemplateData () {
+       public final function getRawTemplateData (): string {
                return $this->rawTemplateData;
        }
 
@@ -803,7 +804,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $compiledData   Compiled template data
         * @return      void
         */
-       private function setCompiledData (string $compiledData) {
+       private function setCompiledData (string $compiledData): void {
                // And store it in this class
                $this->compiledData = $compiledData;
        }
@@ -813,7 +814,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      $compiledData   Compiled template data
         */
-       public final function getCompiledData () {
+       public final function getCompiledData (): string {
                return $this->compiledData;
        }
 
@@ -826,7 +827,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @throws      InvalidArgumentException        If the variable name is left empty
         * @throws      FileNotFoundException   If the template was not found
         */
-       protected function loadTemplate (string $templateName, string $extOther = '') {
+       protected function loadTemplate (string $templateName, string $extOther = ''): void {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: templateName=%s,extOther=%s - CALLED!', $templateName, $extOther));
                if (empty($templateName)) {
@@ -890,7 +891,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $fileInstance   An instance of a SplFileInfo class
         * @return      void
         */
-       private function loadRawTemplateData (SplFileInfo $fileInstance) {
+       private function loadRawTemplateData (SplFileInfo $fileInstance): void {
                // Load the raw template
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: fileInstance=%s - CALLED!', $fileInstance->__toString()));
                $rawTemplateData = $this->getFileIoInstance()->loadFileContents($fileInstance);
@@ -916,7 +917,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $configKey      Possible configuration key
         * @return      void
         */
-       private function assignTemplateVariable (string $variableName, string $configKey = '') {
+       private function assignTemplateVariable (string $variableName, string $configKey = ''): void {
                // Replace all dashes to underscores to match variables with configuration entries
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: variableName=%s,configKey=%s - CALLED!', $variableName, $configKey));
                $variableName = trim(StringUtils::convertDashesToUnderscores($variableName));
@@ -943,7 +944,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $rawData        The raw template data we shall analyze
         * @return      void
         */
-       private function extractVariablesFromRawData (string $rawData) {
+       private function extractVariablesFromRawData (string $rawData): void {
                // Search for variables
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: rawData(%d)=%s - CALLED!', strlen($rawData), $rawData));
                preg_match_all('/\$(\w+)(\[(\w+)\])?/', $rawData, $variableMatches);
@@ -986,7 +987,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * [2] => Array - An array with right part of a match including ':'
         * [3] => Array - An array with right part of a match excluding ':'
         */
-       private function analyzeTemplate (array $templateMatches) {
+       private function analyzeTemplate (array $templateMatches): void {
                // Backup raw template data
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: templateMatches()=%d', count($templateMatches)));
                $backup = $this->getRawTemplateData();
@@ -1056,7 +1057,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $template       The template's name
         * @return      void
         */
-       private function compileCode (string $code, string $template) {
+       private function compileCode (string $code, string $template): void {
                // Is this template already compiled?
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: code=%s,template=%s - CALLED!', $code, $template));
                if (in_array($template, $this->compiledTemplates)) {
@@ -1102,7 +1103,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $templateMatches        See method analyzeTemplate()
         * @return      void
         */
-       private function insertAllTemplates (array $templateMatches) {
+       private function insertAllTemplates (array $templateMatches): void {
                // Run through all loaded codes
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-TEMPLATE: templateMatches()=%d', count($templateMatches)));
                foreach ($this->loadedRawData as $template => $code) {
@@ -1135,7 +1136,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      void
         */
-       private function loadExtraRawTemplates () {
+       private function loadExtraRawTemplates (): void {
                // Are there some raw templates we need to load?
                if (count($this->rawTemplates) > 0) {
                        // Try to load all raw templates
@@ -1168,7 +1169,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @todo        Unfinished work or don't die here.
         */
-       private function assignAllVariables (array $varMatches) {
+       private function assignAllVariables (array $varMatches): void {
                // Search for all variables
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:varMatches()=' . count($varMatches));
                foreach ($varMatches[1] as $key => $var) {
@@ -1201,7 +1202,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $templateMatches        See method analyzeTemplate() for details
         * @return      void
         */
-       private function compileRawTemplateData (array $templateMatches) {
+       private function compileRawTemplateData (array $templateMatches): void {
                // Are some code-templates found which we need to compile?
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE:loadedRawData()= ' .count($this->loadedRawData));
                if (count($this->loadedRawData) > 0) {
@@ -1244,7 +1245,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      void
         */
-       private function insertRawTemplates () {
+       private function insertRawTemplates (): void {
                // Load all templates
                foreach ($this->rawTemplates as $template => $content) {
                        // Set the template as a variable with the content
@@ -1257,7 +1258,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      void
         */
-       private function finalizeVariableCompilation () {
+       private function finalizeVariableCompilation (): void {
                // Get the content
                $content = $this->getRawTemplateData();
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: content before=' . strlen($content) . ' (' . md5($content) . ')');
@@ -1289,7 +1290,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public function loadHtmlTemplate (string $template) {
+       public function loadHtmlTemplate (string $template): void {
                // Validate parameter
                if (empty($template)) {
                        // Throw an exception
@@ -1311,7 +1312,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public final function assignVariable (string $variableName, $value) {
+       public final function assignVariable (string $variableName, mixed $value): void {
                // Validate parameter
                if (empty($variableName)) {
                        // Throw an exception
@@ -1344,7 +1345,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public final function removeVariable (string $variableName, string $variableGroup = 'general') {
+       public final function removeVariable (string $variableName, string $variableGroup = 'general'): void {
                // Validate parameter
                if (empty($variableName)) {
                        // Throw an exception
@@ -1373,7 +1374,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public function assignTemplateWithVariable (string $templateName, string $variableName) {
+       public function assignTemplateWithVariable (string $templateName, string $variableName): void {
                // Validate parameter
                if (empty($templateName)) {
                        // Throw an exception
@@ -1400,7 +1401,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public function assignConfigVariable (string $variableName) {
+       public function assignConfigVariable (string $variableName): void {
                // Validate parameter
                if (empty($variableName)) {
                        // Throw an exception
@@ -1425,7 +1426,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $variables      An array with variables to be assigned
         * @return      void
         */
-       public function assignMultipleVariables (array $variables) {
+       public function assignMultipleVariables (array $variables): void {
                // "Inject" all
                foreach ($variables as $name => $value) {
                        // Set variable with name for 'config' group
@@ -1438,7 +1439,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      void
         */
-       public function assignApplicationData () {
+       public function assignApplicationData (): void {
                // Get application instance
                $applicationInstance = ApplicationHelper::getSelfInstance();
 
@@ -1463,7 +1464,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public function loadCodeTemplate (string $template) {
+       public function loadCodeTemplate (string $template): void {
                // Validate parameter
                if (empty($template)) {
                        // Throw an exception
@@ -1485,7 +1486,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public function loadEmailTemplate (string $template) {
+       public function loadEmailTemplate (string $template): void {
                // Validate parameter
                if (empty($template)) {
                        // Throw an exception
@@ -1506,7 +1507,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      void
         */
-       public final function compileConfigInVariables () {
+       public final function compileConfigInVariables (): void {
                // Do we have the stack?
                if (!$this->isVarStackSet('general')) {
                        // Abort here silently
@@ -1543,7 +1544,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @todo        Make this code some nicer...
         */
-       public final function compileVariables () {
+       public final function compileVariables (): void {
                // Initialize the $content array
                $validVar = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('tpl_valid_var');
                $dummy = [];
@@ -1635,7 +1636,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @throws      InvalidArrayCountException              If an unexpected array
         *                                                                                      count has been found
         */
-       public function compileTemplate () {
+       public function compileTemplate (): void {
                // Get code type to make things shorter
                $codeType = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('code_' . FrameworkBootstrap::getRequestTypeFromSystem() . '_template_type');
 
@@ -1688,10 +1689,10 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * Loads a given view helper (by name)
         *
         * @param       $helperName             The helper's name
-        * @return      void
+        * @return      $helperInstance         An instance of a Helper class
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       protected function loadViewHelper (string $helperName) {
+       protected function loadViewHelper (string $helperName): HelpableTemplate {
                // Validate parameter
                if (empty($helperName)) {
                        // Throw an exception
@@ -1700,11 +1701,8 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
 
                // Is this view helper loaded?
                if (!isset($this->helpers[$helperName])) {
-                       // Create a class name
-                       $className = StringUtils::convertToClassName($helperName) . 'ViewHelper';
-
-                       // Generate new instance
-                       $this->helpers[$helperName] = ObjectFactory::createObjectByName($className);
+                       // Generate new helper instance
+                       $this->helpers[$helperName] = ObjectFactory::createObjectByName(StringUtils::convertToClassName($helperName) . 'ViewHelper');
                }
 
                // Return the requested instance
@@ -1717,7 +1715,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param       $responseInstance       An instance of a Responseable class
         * @return      void
         */
-       public function transferToResponse (Responseable $responseInstance) {
+       public function transferToResponse (Responseable $responseInstance): void {
                // Get the content and set it in response class
                $responseInstance->writeToBody($this->getCompiledData());
        }
@@ -1730,7 +1728,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      $rawCode        Compile code with inserted variable value
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public function compileRawCode (string $rawCode, bool $setMatchAsCode = false) {
+       public function compileRawCode (string $rawCode, bool $setMatchAsCode = false): string {
                // Validate parameter
                if (empty($rawCode)) {
                        // Throw an exception
@@ -1779,7 +1777,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      $variableGroups All variable groups
         */
-       public final function getVariableGroups () {
+       public final function getVariableGroups (): array {
                return $this->variableGroups;
        }
 
@@ -1791,7 +1789,7 @@ abstract class BaseTemplateEngine extends BaseFrameworkSystem {
         * @return      void
         * @throws      InvalidArgumentException        If the variable name is left empty
         */
-       public function renameVariable (string $oldName, string $newName) {
+       public function renameVariable (string $oldName, string $newName): void {
                // Validate parameter
                //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE: oldName=' . $oldName . ', newName=' . $newName);
                if (empty($oldName)) {
index 1908894c84f5d7c6ff596c24f75cc833d2a670d2..9f9e7127446b3a64c36fac092942dfee647706a4 100644 (file)
@@ -154,7 +154,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         * @throws      BasePathReadProtectedException  If $templateBasePath is
         *                                                                                      read-protected
         */
-       public static final function createMenuTemplateEngine (RenderableMenu $menuInstance) {
+       public static final function createMenuTemplateEngine (RenderableMenu $menuInstance): CompileableTemplate {
                // Get a new instance
                $templateInstance = new MenuTemplateEngine();
 
@@ -208,7 +208,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         * @param       $menuInstance   A RenderableMenu instance
         * @return      void
         */
-       protected final function setMenuInstance (RenderableMenu $menuInstance) {
+       protected final function setMenuInstance (RenderableMenu $menuInstance): void {
                $this->menuInstance = $menuInstance;
        }
 
@@ -217,7 +217,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      $menuInstance   A RenderableMenu instance
         */
-       private function getMenuInstance () {
+       private function getMenuInstance (): RenderableMenu {
                return $this->menuInstance;
        }
 
@@ -228,7 +228,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *                                              located in 'menu' by default
         * @return      void
         */
-       public function loadMenuTemplate (string $template) {
+       public function loadMenuTemplate (string $template): void {
                // Set template type
                $this->setTemplateType(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('menu_template_type'));
 
@@ -241,7 +241,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      $currMainNode   Current main node
         */
-       public final function getCurrMainNode () {
+       public final function getCurrMainNode (): string {
                return $this->curr['main_node'];
        }
 
@@ -251,7 +251,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         * @param       $element                Element name to set as current main node
         * @return      $currMainNode   Current main node
         */
-       private function setCurrMainNode (string $element) {
+       private function setCurrMainNode (string $element): void {
                $this->curr['main_node'] = $element;
        }
 
@@ -260,7 +260,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      $mainNodes      Array with valid main node names
         */
-       public final function getMainNodes () {
+       public final function getMainNodes (): array {
                return $this->mainNodes;
        }
 
@@ -269,7 +269,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      $subNodes       Array with valid sub node names
         */
-       public final function getSubNodes () {
+       public final function getSubNodes (): array {
                return $this->subNodes;
        }
 
@@ -405,7 +405,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         * @param       $templateDependency             A template to load to satisfy dependencies
         * @return      void
         */
-       private function startEntryList () {
+       private function startEntryList (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'entry-list');
        }
@@ -415,7 +415,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startBlockHeader () {
+       private function startBlockHeader (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'block-header');
        }
@@ -425,7 +425,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startBlockFooter () {
+       private function startBlockFooter (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'block-footer');
        }
@@ -435,7 +435,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startBlockList () {
+       private function startBlockList (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'block-list');
        }
@@ -445,7 +445,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startBlock () {
+       private function startBlock (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'block');
        }
@@ -455,7 +455,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startTitle () {
+       private function startTitle (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'title');
        }
@@ -465,7 +465,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startTitleId () {
+       private function startTitleId (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'title-id');
        }
@@ -475,7 +475,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startTitleClass () {
+       private function startTitleClass (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'title-class');
        }
@@ -485,7 +485,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startTitleText () {
+       private function startTitleText (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'title-text');
        }
@@ -495,7 +495,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startEntry () {
+       private function startEntry (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'entry');
        }
@@ -505,7 +505,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startEntryId () {
+       private function startEntryId (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'entry-id');
        }
@@ -515,7 +515,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startAnchor () {
+       private function startAnchor (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'anchor');
        }
@@ -525,7 +525,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startAnchorId () {
+       private function startAnchorId (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'anchor-id');
        }
@@ -535,7 +535,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startAnchorText () {
+       private function startAnchorText (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'anchor-text');
        }
@@ -545,7 +545,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startAnchorTitle () {
+       private function startAnchorTitle (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'anchor-title');
        }
@@ -555,7 +555,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startAnchorHref () {
+       private function startAnchorHref (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'anchor-href');
        }
@@ -565,7 +565,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startFooterId () {
+       private function startFooterId (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'footer-id');
        }
@@ -575,7 +575,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startFooterClass () {
+       private function startFooterClass (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'footer-class');
        }
@@ -585,7 +585,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function startFooterText () {
+       private function startFooterText (): void {
                // Push the node name on the stacker
                $this->getStackInstance()->pushNamed('current_node', 'footer-text');
        }
@@ -595,7 +595,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishTitle () {
+       private function finishTitle (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -605,7 +605,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishTitleId () {
+       private function finishTitleId (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -615,7 +615,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishTitleClass () {
+       private function finishTitleClass (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -625,7 +625,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishTitleText () {
+       private function finishTitleText (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -635,7 +635,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishFooterText () {
+       private function finishFooterText (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -645,7 +645,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishFooterClass () {
+       private function finishFooterClass (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -655,7 +655,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishFooterId () {
+       private function finishFooterId (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -665,7 +665,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishAnchorHref () {
+       private function finishAnchorHref (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -675,7 +675,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishAnchorTitle () {
+       private function finishAnchorTitle (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -685,7 +685,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishAnchorText () {
+       private function finishAnchorText (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -695,7 +695,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishAnchorId () {
+       private function finishAnchorId (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -705,7 +705,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishAnchor () {
+       private function finishAnchor (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -715,7 +715,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishEntryId () {
+       private function finishEntryId (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -725,7 +725,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishEntry () {
+       private function finishEntry (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
 
@@ -738,7 +738,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishBlock () {
+       private function finishBlock (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
 
@@ -751,7 +751,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishBlockList () {
+       private function finishBlockList (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -761,7 +761,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishEntryList () {
+       private function finishEntryList (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -771,7 +771,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishBlockHeader () {
+       private function finishBlockHeader (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -781,7 +781,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishBlockFooter () {
+       private function finishBlockFooter (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -791,7 +791,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function finishMenu () {
+       private function finishMenu (): void {
                // Pop the last entry
                $this->getStackInstance()->popNamed('current_node');
        }
@@ -802,7 +802,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function renderMenuEntry () {
+       private function renderMenuEntry (): void {
                // Load menu entry template
                $this->getTemplateInstance()->loadCodeTemplate('menu_entry');
 
@@ -835,7 +835,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      void
         */
-       private function renderMenuBlock () {
+       private function renderMenuBlock (): void {
                // Init block content
                $blockContent = implode('', $this->menuEntries);
 
@@ -870,7 +870,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         *
         * @return      $menuContent    Returned menu content
         */
-       public function getMenuContent () {
+       public function getMenuContent (): string {
                // Implode menuBlocks
                $menuContent = implode('', $this->menuBlocks);
 
index 884a29f3c50cb1a1e09e0d409295e38f5c3a67ad..5ba4a37be45538e2547505c10b4a23f67f51ae90 100644 (file)
@@ -53,7 +53,7 @@ final class ArrayUtils extends BaseFrameworkSystem {
         * @return      $mappedArray    An array with mapped values
         * @throws      InvalidArgumentException        If a aparameter is not valid
         */
-       public static function mapNumericKeysToAssociative (array $numericArray, array $mapping) {
+       public static function mapNumericKeysToAssociative (array $numericArray, array $mapping): array {
                // Validate parameters
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('ARRAY-UTILS: numericArray()=%d,mapping()=%d - CALLED!', count($numericArray), count($mapping)));
                if (count($numericArray) == 0) {
index 69885f9becb021a55ba7fe0a616b132bcf58368a..f2266f6febe35fe0b4c0ed0bc58e0de6567a00a0 100644 (file)
@@ -57,8 +57,10 @@ final class CryptoUtils extends BaseFrameworkSystem {
        /**
         * Since PHP doesn't have static initializers, this method needs to be
         * invoked by each public method here.
+        *
+        * @return      void
         */
-       private static function staticInitializer () {
+       private static function staticInitializer (): void {
                // Is $hashFunction set?
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CRYPRO-UTILS: self::hashFunction[]=%s - CALLED!', gettype(self::$hashFunction)));
                if (empty(self::$hashFunction)) {
@@ -83,7 +85,7 @@ final class CryptoUtils extends BaseFrameworkSystem {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      LogicException  If proper extension hash is not loaded
         */
-       public static final function hash (string $str) {
+       public static final function hash (string $str): string {
                // Validate parameter/mhash extension
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('CRYPTO-UTILS: str=%s - CALLED!', $str));
                if (empty($str)) {
@@ -113,7 +115,7 @@ final class CryptoUtils extends BaseFrameworkSystem {
         *
         * @return      $length         Length of hash() output
         */
-       public static final function getHashLength () {
+       public static final function getHashLength (): int {
                // Invoke static initializer
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('CRYPRO-UTILS: Invoking self::staticInitializer() ... - CALLED!');
                self::staticInitializer();
index aafd71d60021b139cba508934fd2ddb8067ee249..7dee04f4a6196c6dc3af9d39a40902ebc8f00a0d 100644 (file)
@@ -50,7 +50,7 @@ final class NumberUtils extends BaseFrameworkSystem {
         * @return      $localized      Localized value
         * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
-       public static function doFilterFormatNumber (float $value) {
+       public static function doFilterFormatNumber (float $value): string {
                // Check value
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('NUMBER-UTILS: value=%s - CALLED!', $value));
                if ($value < 0) {
@@ -83,7 +83,7 @@ final class NumberUtils extends BaseFrameworkSystem {
         * @return      $readable       A readable timestamp
         * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
-       public static function doFilterFormatTimestamp (string $timestamp = NULL) {
+       public static function doFilterFormatTimestamp (string $timestamp = NULL): string {
                // Check parameter
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('NUMBER-UTILS: timestamp[%s]=%s - CALLED!', gettype($timestamp), $timestamp));
                if (empty($timestamp)) {
@@ -137,7 +137,7 @@ final class NumberUtils extends BaseFrameworkSystem {
         * @return      $formatted      The (hopefully) secured numbered value
         * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
-       public static function bigintval (string $num, bool $castValue = true, bool $assertMismatch = false) {
+       public static function bigintval (string $num, bool $castValue = true, bool $assertMismatch = false): mixed {
                // Check parameter
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('NUMBER-UTILS: num=%s,castValue=%d,assertMismatch=%d - CALLED!', $num, intval($castValue), intval($assertMismatch)));
                if ($num === '') {
index 47b30d0a32e68b6f84b2dcb10e09ce1950379a21..a5ad4710bb57103b2ef3b90c24b3f313b07e1921 100644 (file)
@@ -155,7 +155,7 @@ final class StringUtils extends BaseFrameworkSystem {
         * @throws      NullPointerException    If $str is null
         * @throws      InvalidArgumentException        If $str is empty
         */
-       public static function convertDashesToUnderscores (string $str) {
+       public static function convertDashesToUnderscores (string $str): string {
                // Validate parameter
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: str=%s - CALLED!', $str));
                if (empty($str)) {
@@ -179,7 +179,7 @@ final class StringUtils extends BaseFrameworkSystem {
         * @return      $encoded        Encoded data
         * @throws      InvalidArgumentException        If $rawData has a non-serializable data type
         */
-       public static function encodeData ($rawData) {
+       public static function encodeData (mixed $rawData): string {
                // Make sure no objects or resources pass through
                //* N NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: rawData[]=%s - CALLED!', gettype($rawData)));
                if (is_object($rawData) || is_resource($rawData)) {
@@ -205,7 +205,7 @@ final class StringUtils extends BaseFrameworkSystem {
         * @return      $className      Generated class name
         * @throws      InvalidArgumentException        If a paramter is invalid
         */
-       public static final function convertToClassName (string $str) {
+       public static final function convertToClassName (string $str): string {
                // Is the parameter valid?
                //* N NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: str=%s - CALLED!', $str));
                if (empty($str)) {
@@ -245,7 +245,7 @@ final class StringUtils extends BaseFrameworkSystem {
         * @return      $price          The for the current language formated price string
         * @throws      MissingDecimalsThousandsSeparatorException      If decimals or thousands separator is missing
         */
-       public static function formatCurrency (float $value, string $currency = '&euro;', int $decNum = 2) {
+       public static function formatCurrency (float $value, string $currency = '&euro;', int $decNum = 2): string {
                // Init instance
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: value=%s,currency=%s,decNum=%d - CALLED!', $value, $currency, $decNum));
                $dummyInstance = new StringUtils();
@@ -269,7 +269,7 @@ final class StringUtils extends BaseFrameworkSystem {
         * @return      $dec    Decimal number
         * @throws      InvalidArgumentException        If a paramter is invalid
         */
-       public static function hex2dec (string $hex) {
+       public static function hex2dec (string $hex): int {
                // Check parameter
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: hex=%s - CALLED!', $hex));
                if (empty($hex)) {
@@ -296,7 +296,7 @@ final class StringUtils extends BaseFrameworkSystem {
 
                // Return the decimal number
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: sign=%s,dec=%s - EXIT!', $sign, $dec));
-               return $sign . $dec;
+               return (int) $sign . $dec;
        }
 
        /**
@@ -311,7 +311,7 @@ final class StringUtils extends BaseFrameworkSystem {
         * @return      $hex    Hexadecimal string
         * @throws      InvalidArgumentException        If a paramter is invalid
         */
-       public static function dec2hex (int $dec, int $maxLength = 0) {
+       public static function dec2hex (int $dec, int $maxLength = 0): string {
                // Check parameter
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: dec=%d,maxLength=%d - CALLED!', $dec, $maxLength));
                if ($dec < 0) {
@@ -363,7 +363,7 @@ final class StringUtils extends BaseFrameworkSystem {
         * @return      $dec    Decimal number
         * @throws      InvalidArgumentException        If a paramter is invalid
         */
-       public static function asc2dec (string $asc) {
+       public static function asc2dec (string $asc): int {
                // Check parameter
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: asc=%s - CALLED!', $asc));
                if (empty($asc)) {
@@ -390,7 +390,7 @@ final class StringUtils extends BaseFrameworkSystem {
         * @return      $asc    An ASCII string
         * @throws      InvalidArgumentException        If a paramter is invalid
         */
-       public static function dec2asc (int $dec) {
+       public static function dec2asc (int $dec): string {
                // Check parameter
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: dec=%d - CALLED!', $dec));
                if ($dec < 0) {
@@ -418,7 +418,7 @@ final class StringUtils extends BaseFrameworkSystem {
         * @return      $asc    An ASCII string
         * @throws      InvalidArgumentException        If a paramter is invalid
         */
-       public static function hex2asc (string $hex) {
+       public static function hex2asc (string $hex): string {
                // Check for length, it must be devideable by 2
                /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: hex=%s - CALLED!', $hex));
                if (empty($hex)) {
@@ -453,7 +453,7 @@ final class StringUtils extends BaseFrameworkSystem {
         * @throws      InvalidArgumentException        If a paramter is invalid
         * @todo        Improve documentation
         */
-       private static function packString (string $str) {
+       private static function packString (string $str): string {
                // Check parameter
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: str=%s - CALLED!', $str));
                if (empty($str)) {
@@ -509,7 +509,7 @@ final class StringUtils extends BaseFrameworkSystem {
         * @return      $ret    The (hopefully) secured hext-numbered value
         * @throws      InvalidArgumentException        If a paramter is invalid
         */
-       public static function hexval (string $num, bool $assertMismatch = false) {
+       public static function hexval (string $num, bool $assertMismatch = false): string {
                // Check parameter
                //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: num=%s,assertMismatch=%d - CALLED!', $num, intval($assertMismatch)));
                if (empty($num)) {
index c0350deafdf4e249b96b1a9200f7284e91dc6cdd..d7c2984f36e45943271591b64bd2952f7cde2489 100644 (file)
@@ -36,7 +36,7 @@ interface CompileableTemplate extends FrameworkInterface {
         * @param       $value                  The value we want to store in the variable
         * @return      void
         */
-       function assignVariable (string $variableName, $value);
+       function assignVariable (string $variableName, mixed $value): void;
 
        /**
         * Load a specified HTML template into the engine
@@ -45,7 +45,7 @@ interface CompileableTemplate extends FrameworkInterface {
         *                                              "html" by default
         * @return      void
         */
-       function loadHtmlTemplate (string $template);
+       function loadHtmlTemplate (string $template): void;
 
        /**
         * Load a specified code template into the engine for later compilation
@@ -55,7 +55,7 @@ interface CompileableTemplate extends FrameworkInterface {
         *                                              located in "html" by default
         * @return      void
         */
-       function loadCodeTemplate (string $template);
+       function loadCodeTemplate (string $template): void;
 
        /**
         * Load a specified email template into the engine for later compilation
@@ -65,14 +65,14 @@ interface CompileableTemplate extends FrameworkInterface {
         *                                              located in "html" by default
         * @return      void
         */
-       function loadEmailTemplate (string $template);
+       function loadEmailTemplate (string $template): void;
 
        /**
         * Compile all variables by inserting their respective values
         *
         * @return      void
         */
-       function compileVariables ();
+       function compileVariables (): void;
 
 
        /**
@@ -80,7 +80,7 @@ interface CompileableTemplate extends FrameworkInterface {
         *
         * @return      void
         */
-       function compileTemplate ();
+       function compileTemplate (): void;
 
        /**
         * Adds a variable to current group
@@ -89,7 +89,7 @@ interface CompileableTemplate extends FrameworkInterface {
         * @param       $value                  Value to store in variable
         * @return      void
         */
-       function addGroupVariable (string $variableName, $value);
+       function addGroupVariable (string $variableName, $value): void;
 
        /**
         * Removes a given variable
@@ -98,7 +98,7 @@ interface CompileableTemplate extends FrameworkInterface {
         * @param       $variableGroup  Name of variable group (default: 'general')
         * @return      void
         */
-       function removeVariable (string $variableName, string $variableGroup = 'general');
+       function removeVariable (string $variableName, string $variableGroup = 'general'): void;
 
        /**
         * Assign a given congfiguration variable with a value
@@ -106,7 +106,7 @@ interface CompileableTemplate extends FrameworkInterface {
         * @param       $variableName   The configuration variable we want to assign
         * @return      void
         */
-       function assignConfigVariable (string $variableName);
+       function assignConfigVariable (string $variableName): void;
 
        /**
         * Compiles configuration place-holders in all variables. This 'walks'
@@ -115,7 +115,7 @@ interface CompileableTemplate extends FrameworkInterface {
         *
         * @return      void
         */
-       function compileConfigInVariables ();
+       function compileConfigInVariables (): void;
 
        /**
         * Assigns the last loaded raw template content with a given variable
@@ -124,7 +124,7 @@ interface CompileableTemplate extends FrameworkInterface {
         * @param       $variableName   Name of the variable we want to assign
         * @return      void
         */
-       function assignTemplateWithVariable (string $templateName, string $variableName);
+       function assignTemplateWithVariable (string $templateName, string $variableName): void;
 
        /**
         * Transfers the content of this template engine to a given response instance
@@ -132,14 +132,14 @@ interface CompileableTemplate extends FrameworkInterface {
         * @param       $responseInstance       An instance of a Responseable class
         * @return      void
         */
-       function transferToResponse (Responseable $responseInstance);
+       function transferToResponse (Responseable $responseInstance): void;
 
        /**
         * Assigns all the application data with template variables
         *
         * @return      void
         */
-       function assignApplicationData ();
+       function assignApplicationData (): void;
 
        /**
         * "Compiles" a variable by replacing {?var?} with it's content
@@ -148,7 +148,7 @@ interface CompileableTemplate extends FrameworkInterface {
         * @param       $setMatchAsCode         Sets $match if readVariable() returns empty result (default: false)
         * @return      $rawCode                        Compile code with inserted variable value
         */
-       function compileRawCode (string $rawCode, bool $setMatchAsCode = false);
+       function compileRawCode (string $rawCode, bool $setMatchAsCode = false): string;
 
        /**
         * Renames a variable in code and in stack
@@ -157,7 +157,7 @@ interface CompileableTemplate extends FrameworkInterface {
         * @param       $newName        New name of variable
         * @return      void
         */
-       function renameVariable (string $oldName, string $newName);
+       function renameVariable (string $oldName, string $newName): void;
 
        /**
         * Enables or disables language support
@@ -180,7 +180,7 @@ interface CompileableTemplate extends FrameworkInterface {
         * @param       $variableGroup  Variable group to check
         * @return      $varStack               Found variable group
         */
-       function getVarStack (string $variableGroup);
+       function getVarStack (string $variableGroup): array;
 
        /**
         * Settter for variable group
@@ -189,28 +189,28 @@ interface CompileableTemplate extends FrameworkInterface {
         * @param       $add            Whether add this group
         * @return      void
         */
-       function setVariableGroup (string $groupName, bool $add = true);
+       function setVariableGroup (string $groupName, bool $add = true): void;
 
        /**
         * Getter for template type
         *
         * @return      $templateType   The current template's type
         */
-       function getTemplateType ();
+       function getTemplateType (): string;
 
        /**
         * Getter for base path
         *
         * @return      $templateBasePath       The relative base path for all templates
         */
-       function getTemplateBasePath ();
+       function getTemplateBasePath (): string;
 
        /**
         * Getter for generic base path
         *
         * @return      $templateBasePath       The relative base path for all templates
         */
-       function getGenericBasePath ();
+       function getGenericBasePath (): string;
 
        /**
         * Getter for template extension
@@ -218,7 +218,7 @@ interface CompileableTemplate extends FrameworkInterface {
         * @return      $templateExtension      The file extension for all uncompiled
         *                                                      templates
         */
-       function getRawTemplateExtension ();
+       function getRawTemplateExtension (): string;
 
        /**
         * Getter for code-template extension
@@ -226,14 +226,14 @@ interface CompileableTemplate extends FrameworkInterface {
         * @return      $codeExtension          The file extension for all code-
         *                                                      templates
         */
-       function getCodeTemplateExtension ();
+       function getCodeTemplateExtension (): string;
 
        /**
         * Getter for raw template data
         *
         * @return      $rawTemplateData        The raw data from the template
         */
-       function getRawTemplateData ();
+       function getRawTemplateData (): string;
 
        /**
         * Assigns a lot variables into the stack of currently loaded template.
@@ -245,13 +245,13 @@ interface CompileableTemplate extends FrameworkInterface {
         * @param       $variables      An array with variables to be assigned
         * @return      void
         */
-       function assignMultipleVariables (array $variables);
+       function assignMultipleVariables (array $variables): void;
 
        /**
         * Getter for variable group array
         *
         * @return      $variableGroups All variable groups
         */
-       function getVariableGroups ();
+       function getVariableGroups (): array;
 
 }