]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 5 Sep 2025 01:10:19 +0000 (03:10 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 5 Sep 2025 01:27:12 +0000 (03:27 +0200)
- added more type-hints
- added method updateLastActivity() to ManageableAccount interface

22 files changed:
framework/main/classes/criteria/class_BaseCriteria.php
framework/main/classes/database/frontend/news/class_NewsDatabaseFrontend.php
framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php
framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php
framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php
framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php
framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php
framework/main/classes/file_directories/text/output/class_BaseOutputTextFile.php
framework/main/classes/output/console/class_ConsoleOutput.php
framework/main/classes/output/debug/console/class_DebugConsoleOutput.php
framework/main/classes/output/debug/error/class_DebugErrorLogOutput.php
framework/main/classes/output/debug/web/class_DebugWebOutput.php
framework/main/classes/output/web/class_WebOutput.php
framework/main/classes/streams/crypto/null/class_NullCryptoStream.php
framework/main/classes/streams/crypto/openssl/class_OpenSslStream.php
framework/main/classes/user/class_BaseUser.php
framework/main/classes/user/guest/class_Guest.php
framework/main/classes/user/member/class_Member.php
framework/main/interfaces/io/file/csv/class_CsvInputStreamer.php
framework/main/interfaces/streams/class_Stream.php
framework/main/interfaces/streams/crypto/class_EncryptableStream.php
framework/main/interfaces/user/class_ManageableAccount.php

index 0a8889f37a1d034eebf55187c420599893ff587c..95aef4b1059303d51d96bef84d8cee11745c7734 100644 (file)
@@ -81,7 +81,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @return      $count  Count of all criteria entries
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       protected final function count (string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
+       protected final function count (string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT): int {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaType));
                if (empty($criteriaType)) {
@@ -106,7 +106,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      UnexpectedValueException        If a parameter contains an unexpected/unsupported value
         */
-       public function isKeySet (string $criteriaType, string $criteriaKey) {
+       public function isKeySet (string $criteriaType, string $criteriaKey): bool {
                // Check parameters
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaType=%s,criteriaKey=%s - CALLED!', strtoupper($criteriaType), $criteriaType, $criteriaKey));
                if (empty($criteriaType)) {
@@ -139,7 +139,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @return      $isset                  Whether key is set
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       public function isChoiceKeySet (string $criteriaKey) {
+       public function isChoiceKeySet (string $criteriaKey): bool {
                // Validate parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
                if (empty($criteriaKey)) {
@@ -159,7 +159,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @return      $isset                  Whether key is set
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       public function isExcludeKeySet (string $criteriaKey) {
+       public function isExcludeKeySet (string $criteriaKey): bool {
                // Validate parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
                if (empty($criteriaKey)) {
@@ -178,7 +178,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @param       $frontendConfigEntry            Configuration entry which hold the frontend class' name
         * @return      void
         */
-       public final function setFrontendConfigEntry (string $frontendConfigEntry) {
+       public final function setFrontendConfigEntry (string $frontendConfigEntry): void {
                $this->frontendConfigEntry = $frontendConfigEntry;
        }
 
@@ -187,7 +187,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         *
         * @return      $frontendConfigEntry            Configuration entry which hold the frontend class' name
         */
-       public final function getFrontendConfigEntry () {
+       public final function getFrontendConfigEntry (): string {
                return $this->frontendConfigEntry;
        }
 
@@ -199,7 +199,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      UnexpectedValueException        If a parameter contains an unexpected/unsupported value
         */
-       public final function getCriteriaArray (string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
+       public final function getCriteriaArray (string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT): array {
                // Check parameters
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaType));
                if (empty($criteriaType)) {
@@ -220,7 +220,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         *
         * @return      $criteria
         */
-       public final function getCriteriaChoiceArray () {
+       public final function getCriteriaChoiceArray (): array {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: CALLED!', strtoupper($criteriaType)));
                return $this->getCriteriaArray(Criteria::CRITERIA_TYPE_CHOICE);
        }
@@ -230,7 +230,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         *
         * @return      $criteria
         */
-       public final function getCriteriaExcludeArray () {
+       public final function getCriteriaExcludeArray (): array {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-CRITERIA: CALLED!');
                return $this->getCriteriaArray(Criteria::CRITERIA_TYPE_EXCLUDE);
        }
@@ -241,7 +241,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @param       $criteriaKey    Criteria key to unset
         * @return      void
         */
-       public final function unsetCriteria (string $criteriaKey) {
+       public final function unsetCriteria (string $criteriaKey): void {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
                if (empty($criteriaKey)) {
@@ -279,7 +279,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      UnexpectedValueException        If a parameter contains an unexpected/unsupported value
         */
-       public final function addCriteria (string $criteriaKey, $criteriaValue, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
+       public final function addCriteria (string $criteriaKey, $criteriaValue, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT): void {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[]=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaType));
                if (empty($criteriaKey)) {
@@ -322,7 +322,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      UnexpectedValueException        If a parameter contains an unexpected/unsupported value
         */
-       public final function setCriteria (string $criteriaKey, $criteriaValue, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
+       public final function setCriteria (string $criteriaKey, $criteriaValue, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT): void {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaValue[]=%s$criteriaValue,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, gettype($criteriaValue), $criteriaType));
                if (empty($criteriaKey)) {
@@ -364,7 +364,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      UnexpectedValueException        If $criteriaValue has an unexpected type
         */
-       public final function addChoiceCriteria (string $criteriaKey, $criteriaValue) {
+       public final function addChoiceCriteria (string $criteriaKey, mixed $criteriaValue): void {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s,criteriaValue[]=%s - CALLED!', $criteriaKey, gettype($criteriaValue)));
                if (empty($criteriaKey)) {
@@ -400,7 +400,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      UnexpectedValueException        If $criteriaValue has an unexpected type
         */
-       public final function addExcludeCriteria (string $criteriaKey, $criteriaValue) {
+       public final function addExcludeCriteria (string $criteriaKey, mixed $criteriaValue): void {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s,criteriaValue[%s]=%s - CALLED!', $criteriaKey, gettype($criteriaValue), $criteriaValue));
                if (empty($criteriaKey)) {
@@ -432,7 +432,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      UnexpectedValueException        If a parameter contains an unexpected/unsupported value
         */
-       public final function addConfiguredCriteria (string $criteriaKey, string $configEntry, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
+       public final function addConfiguredCriteria (string $criteriaKey, string $configEntry, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT): void {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaKey=%s,configEntry=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, $configEntry, $criteriaType));
                if (empty($criteriaKey)) {
@@ -472,7 +472,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      UnexpectedValueException        If a parameter contains an unexpected/unsupported value
         */
-       public function getCriteriaElemnent (string $criteriaKey, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
+       public function getCriteriaElemnent (string $criteriaKey, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT): mixed {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: criteriaKey=%s,criteriaType=%s - CALLED!', strtoupper($criteriaType), $criteriaKey, $criteriaType));
                if (empty($criteriaKey)) {
@@ -515,7 +515,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @return      $value                  Whether the value of the critera or false
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       public function getCriteriaChoiceElemnent (string $criteriaKey) {
+       public function getCriteriaChoiceElemnent (string $criteriaKey): mixed {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
                if (empty($criteriaKey)) {
@@ -538,7 +538,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @return      $value                  Whether the value of the critera or false
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       public function getCriteriaExcludeElemnent (string $criteriaKey) {
+       public function getCriteriaExcludeElemnent (string $criteriaKey): mixed {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: criteriaKey=%s - CALLED!', $criteriaKey));
                if (empty($criteriaKey)) {
@@ -563,7 +563,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      UnexpectedValueException        If a parameter contains an unexpected/unsupported value
         */
-       public function ifEntryMatches (array $entryArray, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
+       public function ifEntryMatches (array $entryArray, string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT): bool {
                // Check parameters
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: entryArray()=%d,criteriaType=%s - CALLED!', strtoupper($criteriaType), count($entryArray), $criteriaType));
                if (count($entryArray) == 0) {
@@ -635,7 +635,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @return      $matches                Whether the entry matches or not
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       public function ifChoiceMatches (array $entryArray) {
+       public function ifChoiceMatches (array $entryArray): bool {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: entryArray()=%d - CALLED!', count($entryArray)));
                if (count($entryArray) == 0) {
@@ -655,7 +655,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @return      $matches                Whether the entry matches or not
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       public function ifExcludeMatches (array $entryArray) {
+       public function ifExcludeMatches (array $entryArray): bool {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: entryArray()=%d - CALLED!', count($entryArray)));
                if (count($entryArray) == 0) {
@@ -678,7 +678,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @throws      UnexpectedValueException        If a parameter contains an unexpected/unsupported value
         * @throws      BadMethodCallException  If this method is invoked before $criteriaType has been initialized
         */
-       public function getCacheKey (array $onlyKeys = [], string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT) {
+       public function getCacheKey (array $onlyKeys = [], string $criteriaType = Criteria::CRITERIA_TYPE_DEFAULT): string {
                // Check parameters
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-CRITERIA: onlyKeys()=%d,criteriaType=%s - CALLED!', strtoupper($criteriaType), count($onlyKeys), $criteriaType));
                if (empty($criteriaType)) {
@@ -751,7 +751,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @param       $onlyKeys       Only use these keys for a cache key
         * @return      $cacheKey       The key suitable for the cache system
         */
-       public function getCacheKeyChoice (array $onlyKeys = []) {
+       public function getCacheKeyChoice (array $onlyKeys = []): string {
                // Trace message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: onlyKeys()=%d - CALLED!', count($onlyKeys)));
 
@@ -766,7 +766,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         * @param       $onlyKeys       Only use these keys for a cache key
         * @return      $cacheKey       The key suitable for the cache system
         */
-       public function getCacheKeyExclude (array $onlyKeys = []) {
+       public function getCacheKeyExclude (array $onlyKeys = []): string {
                // Trace message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-CRITERIA: onlyKeys()=%d - CALLED!', count($onlyKeys)));
 
@@ -781,7 +781,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         *
         * @return      $count  Count of all criteria entries
         */
-       public final function countChoice () {
+       public final function countChoice (): int {
                // Trace message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-CRITERIA: CALLED!');
                return $this->count(Criteria::CRITERIA_TYPE_CHOICE);
@@ -793,7 +793,7 @@ abstract class BaseCriteria extends BaseFrameworkSystem implements Criteria {
         *
         * @return      $count  Count of all criteria entries
         */
-       public final function countExclude () {
+       public final function countExclude (): int {
                // Trace message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-CRITERIA: CALLED!');
                return $this->count(Criteria::CRITERIA_TYPE_EXCLUDE);
index 0429b923dd27969c80b168a490ac2466250e6e82..5f1ca594baedf7e84b04fdaee40413d1745de784 100644 (file)
@@ -49,7 +49,7 @@ class NewsDatabaseFrontend extends BaseDatabaseFrontend implements DatabaseFront
         *
         * @return      $frontendInstance       An instance of the created frontend class
         */
-       public static final function createNewsDatabaseFrontend () {
+       public static final function createNewsDatabaseFrontend (): DatabaseFrontend {
                // Get a new instance
                $frontendInstance = new NewsDatabaseFrontend();
 
index 76868c64352a55c9db98e0c49e2aeb14180066ac..2b033f75bc0b2f13828f905b3b4454c2f28b01c3 100644 (file)
@@ -104,17 +104,13 @@ class FrameworkRawFileInputPointer extends BaseFileIo implements InputPointer {
         *
         * @return      mixed   The result of fread()
         * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
-        * @throws      LogicException  If there is no object being set
         */
        public function readFromFile (): string {
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('RAW-FILE-INPUT-POINTER: CALLED!');
-               if (is_null($this->getFileObject())) {
+               if (!$this->isFileObjectValid()) {
                        // Pointer not initialized
                        throw new NullPointerException($this, FrameworkInterface::EXCEPTION_IS_NULL_POINTER);
-               } elseif (!is_object($this->getFileObject())) {
-                       // Pointer is not a valid resource!
-                       throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject())), FrameworkInterface::EXCEPTION_LOGIC_EXCEPTION);
                }
 
                // Read data from the file pointer and return it
index 9aeb6e017e92f0130e8404f6173951607a0aa90c..d6ed3f1bdcfd7f65bb34df364e96bbf15594525e 100644 (file)
@@ -15,6 +15,7 @@ use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 
 // Import SPL stuff
+use \InvalidArgumentException;
 use \SplFileInfo;
 use \SplFileObject;
 
@@ -124,7 +125,6 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer {
         * @return      $data   Data read from file
         * @throws      OutOfBoundsException    If the position is not seekable
         * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
-        * @throws      LogicException  If $fileObject is not an object
         */
        public function read (int $bytes = 0): string {
                // Some sanity checks
@@ -132,12 +132,9 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer {
                if ($bytes < 0) {
                        // Cannot be below zero
                        throw new OutOfBoundsException(sprintf('bytes=%d is not valid', $bytes));
-               } elseif (is_null($this->getFileObject())) {
+               } elseif (!$this->isFileObjectValid()) {
                        // Pointer not initialized
                        throw new NullPointerException($this, FrameworkInterface::EXCEPTION_IS_NULL_POINTER);
-               } elseif (!is_object($this->getFileObject())) {
-                       // Pointer is not a valid resource!
-                       throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject())), FrameworkInterface::EXCEPTION_LOGIC_EXCEPTION);
                }
 
                // Is $bytes set?
index 3f78cd8471325991ed1fc6a1ef546847d9497362..aedb9355ac85cef9d1fc52781b40402e9c98a9bf 100644 (file)
@@ -96,7 +96,6 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer
         * @return      mixed                   Number of writes bytes or false on error
         * @throws      InvalidArgumentException        If a parameter is invalid
         * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
-        * @throws      LogicException  If there is no object being set
         */
        public function writeToFile (string $dataStream): mixed {
                // Validate parameter and class own attributes
@@ -104,12 +103,9 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer
                if (empty($dataStream)) {
                        // Empty data stream
                        throw new InvalidArgumentException('Parameter "dataStream" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
-               } elseif (is_null($this->getFileObject())) {
+               } elseif (!$this->isFileObjectValid()) {
                        // Pointer not initialized
                        throw new NullPointerException($this, FrameworkInterface::EXCEPTION_IS_NULL_POINTER);
-               } elseif (!is_object($this->getFileObject())) {
-                       // Pointer is not a valid resource!
-                       throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject())), FrameworkInterface::EXCEPTION_LOGIC_EXCEPTION);
                }
 
                // Write data to the file pointer and return written bytes
index 93fe285cd22e4bbf7a699e0809a6ffe0b853b206..94992c9cda37b97492a6da1429fbe09b1c7957de 100644 (file)
@@ -93,7 +93,6 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer
         * @param       $dataStream             The data stream we shall write to the file
         * @return      mixed                   Number of writes bytes or false on error
         * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
-        * @throws      LogicException  If there is no object being set
         */
        public function writeToFile (string $dataStream): mixed {
                // Validate parameter
@@ -101,12 +100,9 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer
                if (empty($dataStream)) {
                        // Invalid parameter
                        throw new InvalidArgumentException('Parameter "dataStream" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
-               } elseif (is_null($this->getFileObject())) {
+               } elseif (!$this->isFileObjectValid()) {
                        // Pointer not initialized
                        throw new NullPointerException($this, FrameworkInterface::EXCEPTION_IS_NULL_POINTER);
-               } elseif (!is_object($this->getFileObject())) {
-                       // Pointer is not a valid object!
-                       throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject())), FrameworkInterface::EXCEPTION_LOGIC_EXCEPTION);
                }
 
                // Write data to the file pointer and return written bytes
index f5be651f8965575f7899ccbce40cdf27aa39223f..6cba39a7494aa797436ae6e5386ce455237d9328 100644 (file)
@@ -51,7 +51,7 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer {
         * @param       $infoInstance   An instance of a SplFileInfo class
         * @return      $fileInstance   An instance of this File class
         */
-       public final static function createCsvInputFile (SplFileInfo $infoInstance) {
+       public final static function createCsvInputFile (SplFileInfo $infoInstance): CsvInputStreamer {
                // Get a new instance
                $fileInstance = new CsvInputFile();
 
@@ -73,7 +73,7 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer {
         * @throws      InvalidArgumentException        If a parameter is invalid
         * @throws      UnexpectedValueException        If the array count is not matching expected count
         */
-       public function readCsvFileLine (string $columnSeparator, int $expectedMatches = 0) {
+       public function readCsvFileLine (string $columnSeparator, int $expectedMatches = 0): array {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] columnSeparator=%s,expectedMatches=%d - CALLED!', __METHOD__, __LINE__, $columnSeparator, $expectedMatches));
                if (strlen($columnSeparator) === 0) {
@@ -92,7 +92,7 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer {
                if (empty($data)) {
                        // Yes, then skip below code
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] Read data is an empty line - EXIT!', __METHOD__, __LINE__));
-                       return;
+                       return [];
                }
 
                // Parse data
@@ -117,7 +117,7 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer {
         * @param       $columnSeparator        Character to use separting columns
         * @return      $lineArray                      An indexed array with the read line
         */
-       private function parseDataToIndexedArray (string $data, string $columnSeparator) {
+       private function parseDataToIndexedArray (string $data, string $columnSeparator): array {
                // Init return array
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] data()=%d,columnSeparator=%s - CALLED!', __METHOD__, __LINE__, strlen($data), $columnSeparator));
                $lineArray = [];
index fd56b83212ab42c7959ff2ad52191844bb7cb68c..0f936f9242816e3358108d5c1baf9c1017676c71 100644 (file)
@@ -49,7 +49,7 @@ abstract class BaseOutputTextFile extends BaseAbstractFile {
         * @return      void
         * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
-       protected function initFile (string $fileName) {
+       protected function initFile (string $fileName): void {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-OUTPUT-TEXT-FILE: fileName=%s - CALLED!', $fileName));
                if (empty($fileName)) {
index 3cca9157c5b77cec072b65cd9554a2dbe352ed5d..b5c08d826bc7223b90e663a49e90835e85027b92 100644 (file)
@@ -51,9 +51,9 @@ class ConsoleOutput extends BaseOutput implements OutputStreamer {
         * Create a new web output system and set the content type
         *
         * @param       $contentType    A valid content-type
-        * @return      $debugInstance  An instance of this middleware class
+        * @return      $debugInstance  An instance of an OutputStreamer class
         */
-       public static final function createConsoleOutput (string $contentType) {
+       public static final function createConsoleOutput (string $contentType): OutputStreamer {
                // Cast the content-type to string
                $contentType = trim($contentType);
 
@@ -75,9 +75,9 @@ class ConsoleOutput extends BaseOutput implements OutputStreamer {
        /**
         * Getter for an instance of this class
         *
-        * @return      $consoleInstance        An instance of this class
+        * @return      $consoleInstance        An instance of an OutputStreamer class
         */
-       public static final function getInstance() {
+       public static final function getInstance(): OutputStreamer {
                // Is the self-instance already set?
                if (is_null(self::$consoleInstance)) {
                        $contentType = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('web_content_type');
@@ -95,7 +95,7 @@ class ConsoleOutput extends BaseOutput implements OutputStreamer {
         * @param       $stripTags      Whether HTML tags shall be stripped out
         * @return      void
         */
-       public final function output (string $outStream = '', bool $stripTags = false) {
+       public final function output (string $outStream = '', bool $stripTags = false): void {
                print trim($outStream) . PHP_EOL;
        }
 
index 41af45cf9324efa997a91c63e787bb71e70234b6..5db772c82614541ffb344fe691d6d49be7204601 100644 (file)
@@ -110,7 +110,7 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre
         * @return      $data   The data (string mostly) to "stream"
         * @throws      UnsupportedOperationException   If this method is called
         */
-       public function streamData (string $data) {
+       public function streamData (string $data): string {
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.');
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
index eae51dc0d6e78fe76ff6bde6d4e99871edf9ae1c..4e66ba8b9b85a61c7809e7145ba1ee654a774138 100644 (file)
@@ -100,7 +100,7 @@ class DebugErrorLogOutput extends BaseDebugOutput implements Debugger, OutputStr
         * @return      $data   The data (string mostly) to "stream"
         * @throws      UnsupportedOperationException   If this method is called
         */
-       public function streamData (string $data) {
+       public function streamData (string $data): string {
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.');
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
index 58b3ae8ac49a6685eada49b2c376056f16d972f8..761b7044c174575c80b241d7e234e448e9930f50 100644 (file)
@@ -89,7 +89,7 @@ class DebugWebOutput extends BaseDebugOutput implements Debugger, OutputStreamer
         * @return      $data   The data (string mostly) to "stream"
         * @throws      UnsupportedOperationException   If this method is called
         */
-       public function streamData (string $data) {
+       public function streamData (string $data): string {
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.');
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
index 087ce929fbb32410a5ab1c03c6f85bb5cae872ae..678bb935135f4bf5e343808eeebea0ad590ccaa8 100644 (file)
@@ -53,7 +53,7 @@ class WebOutput extends BaseOutput implements OutputStreamer, Registerable {
         *
         * @return      $webInstance    An instance of an OutputStreamer class
         */
-       public static final function createWebOutput () {
+       public static final function createWebOutput (): OutputStreamer {
                // Is the self-instance already set?
                if (is_null(self::$webInstance)) {
                        // Get a new instance and set it
@@ -80,7 +80,7 @@ class WebOutput extends BaseOutput implements OutputStreamer, Registerable {
         * @param       $stripTags      Whether HTML tags shall be stripped out
         * @return      void
         */
-       public final function output (string $outStream = '', bool $stripTags = false) {
+       public final function output (string $outStream = '', bool $stripTags = false): void {
                print(stripslashes($outStream));
        }
 
index 2f79b5080fde58226ca0db9ee4430f57198cabf1..94d1afa75b31c0f10e7683bba9316fbf39266d89 100644 (file)
@@ -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): mixed {
+       public function streamData (string $data): string {
                self::createDebugInstance(__CLASS__, __LINE__)->warningMessage('Unhandled ' . strlen($data) . ' bytes in this stream.');
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
index bc721e68d9cfe12edcc1d4b4e36cc1e4fdc89834..622496dfe97c191b5a4433c5ca973c7e44e8cb26 100644 (file)
@@ -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): mixed {
+       public function streamData (string $data): string {
                self::createDebugInstance(__CLASS__, __LINE__)->warningMessage('Unhandled ' . strlen($data) . ' bytes in this stream.');
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
index f6243cf213a1756605e145c606742d343dc33786..b4b69e6dde53a01eb602a1d5abb88136312ff50e 100644 (file)
@@ -96,7 +96,7 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
         * @return      void
         * @todo        Find a way of casting here. "(int)" might destroy the user id > 32766
         */
-       public final function setUserId (int $userId) {
+       public final function setUserId (int $userId): void {
                $this->userId = $userId;
        }
 
@@ -115,7 +115,7 @@ abstract class BaseUser extends BaseFrameworkSystem implements Updateable {
         * @param       $email  The email to set
         * @return      void
         */
-       protected final function setEmail (string $email) {
+       protected final function setEmail (string $email): void {
                $this->email = $email;
        }
 
index 7f81caba9cfb3355b812ca0c9a4eb082bcc5dd1e..f870dfb9f148381da3d8178e3a114910cf2aa9c5 100644 (file)
@@ -59,7 +59,7 @@ class Guest extends BaseUser implements ManageableGuest, Registerable {
         * @return      $userInstance           An instance of this user class
         * @todo        Add more ways over creating user classes
         */
-       public static final function createGuestByRequest (Requestable $requestInstance) {
+       public static final function createGuestByRequest (Requestable $requestInstance): ManageableGuest {
                // Determine if by email or username
                if (!is_null($requestInstance->getRequestElement('username'))) {
                        // Username supplied
@@ -88,7 +88,7 @@ class Guest extends BaseUser implements ManageableGuest, Registerable {
         * @throws      UsernameMissingException        If the username does not exist
         * @throws      UserNoGuestException            If the user is no guest account
         */
-       public static final function createGuestByUsername (string $userName) {
+       public static final function createGuestByUsername (string $userName): ManageableGuest {
                // Check parameter
                if (empty($userName)) {
                        // Throw IAE
@@ -121,7 +121,7 @@ class Guest extends BaseUser implements ManageableGuest, Registerable {
         * @param       $email                  Email address of the user
         * @return      $userInstance   An instance of this user class
         */
-       public static final function createGuestByEmail (string $email) {
+       public static final function createGuestByEmail (string $email): ManageableGuest {
                // Check parameter
                if (empty($email)) {
                        // Throw IAE
@@ -145,7 +145,7 @@ class Guest extends BaseUser implements ManageableGuest, Registerable {
         * @param       $requestInstance        A requestable class instance
         * @return      void
         */
-       public function updateLastActivity (Requestable $requestInstance) {
+       public function updateLastActivity (Requestable $requestInstance): void {
                // No activity will be logged for guest accounts
        }
 
index 0114bcfb76f3a3c0c3b0f25e1cae7f0818e2d23d..240de96f9cf2f18e54d092a674a8fc383109bc82 100644 (file)
@@ -58,7 +58,7 @@ class Member extends BaseUser implements ManageableMember, Registerable {
         * @throws      UsernameMissingException        If the username does not exist
         * @throws      UnexpectedGuestAccountException         If the user status is 'guest'
         */
-       public static final function createMemberByUsername (string $userName) {
+       public static final function createMemberByUsername (string $userName): ManageableMember {
                // Check parameter
                if (empty($userName)) {
                        // Throw IAE
@@ -91,7 +91,7 @@ class Member extends BaseUser implements ManageableMember, Registerable {
         * @param       $email                  Email address of the user
         * @return      $userInstance   An instance of this user class
         */
-       public static final function createMemberByEmail (string $email) {
+       public static final function createMemberByEmail (string $email): ManageableMember {
                // Check parameter
                if (empty($email)) {
                        // Throw IAE
@@ -115,7 +115,7 @@ class Member extends BaseUser implements ManageableMember, Registerable {
         * @return      $userInstance           An instance of this user class
         * @todo        Add more ways over creating user classes
         */
-       public static final function createMemberByRequest (Requestable $requestInstance) {
+       public static final function createMemberByRequest (Requestable $requestInstance): ManageableMember {
                // Determine if by email or username
                if (!is_null($requestInstance->getRequestElement('username'))) {
                        // Username supplied
@@ -141,7 +141,7 @@ class Member extends BaseUser implements ManageableMember, Registerable {
         * @param       $requestInstance        A requestable class instance
         * @return      void
         */
-       public function updateLastActivity (Requestable $requestInstance) {
+       public function updateLastActivity (Requestable $requestInstance): void {
                // Set last action
                $lastAction = $requestInstance->getRequestElement('action');
 
index 138037ae67abdd07975066f9b89fa15eb7561998..8a3ccef882dd90cc465261fd3df07831da1df792 100644 (file)
@@ -36,6 +36,6 @@ interface CsvInputStreamer extends FileInputStreamer {
         * @return      $lineArray                      An index array with the read line
         * @throws      InvalidArgumentException        If a parameter is invalid
         */
-       function readCsvFileLine (string $columnSeparator, int $expectedMatches = 0);
+       function readCsvFileLine (string $columnSeparator, int $expectedMatches = 0): array;
 
 }
index 310e7a65d537bf2fad82670541d125deca867135..cce4c256ec967b085da4dcdd351cb2b2c7c7354d 100644 (file)
@@ -34,6 +34,6 @@ interface Stream extends FrameworkInterface {
         * @param       $data   The data (string mostly) to "stream"
         * @return      $data   The data (string mostly) to "stream"
         */
-       function streamData (string $data);
+       function streamData (string $data): string;
 
 }
index 8542b57a2de082472034c2469b9fcc5b699353e7..0ba33329191cc257b2da180e52e49bf9471dbd74 100644 (file)
@@ -40,7 +40,7 @@ interface EncryptableStream extends Stream {
         * @param       $key            Optional key, if none provided, a random key will be generated
         * @return      $encrypted      Encrypted string
         */
-       function encryptStream (string $str, string $key = NULL);
+       function encryptStream (string $str, string $key = NULL): string;
 
        /**
         * Decrypt the string with fixed salt
@@ -49,6 +49,6 @@ interface EncryptableStream extends Stream {
         * @param       $key            Optional key, if none provided, a random key will be generated
         * @return      $str            The unencrypted string
         */
-       function decryptStream (string $encrypted, string $key = NULL);
+       function decryptStream (string $encrypted, string $key = NULL): string;
 
 }
index b6877a2aaaf5fafcd37f02f55402aca6ff04f5f0..841c4de366ee3fa0d18cc59cfabae06448263d0f 100644 (file)
@@ -52,4 +52,13 @@ interface ManageableAccount extends FrameworkInterface {
         */
        function ifPasswordHashMatches (Requestable $requestInstance): bool;
 
+       /**
+        * Updates the last activity timestamp and last performed action in the
+        * database result.
+        *
+        * @param       $requestInstance        A requestable class instance
+        * @return      void
+        */
+       function updateLastActivity (Requestable $requestInstance): void;
+
 }