Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 10 Jul 2022 11:30:51 +0000 (13:30 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 10 Jul 2022 11:30:51 +0000 (13:30 +0200)
- added missing type-hints

framework/main/classes/class_BaseFrameworkSystem.php
framework/main/classes/compressor/class_Bzip2Compressor.php
framework/main/classes/compressor/class_GzipCompressor.php
framework/main/classes/compressor/class_NullCompressor.php
framework/main/classes/compressor/class_ZlibCompressor.php
framework/main/classes/points/class_UserPoints.php
framework/main/interfaces/compressor/class_Compressor.php
framework/main/interfaces/points/class_BookablePoints.php

index 35add654821bbb2f338327e73b391eb7b319a417..36e7bd6b64d49a8103407e060403f212fe29a2e5 100644 (file)
@@ -1337,7 +1337,7 @@ Loaded includes:
         * @param       $keyGroup       Main group for the key
         * @return      $count          Count of given group
         */
-       protected final function countGenericArray ($keyGroup) {
+       protected final function countGenericArray (string $keyGroup) {
                // Debug message
                //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup);
 
@@ -1425,7 +1425,7 @@ Loaded includes:
         * @param       $keyGroup       Key group to get
         * @return      $array          Whole generic array group
         */
-       protected final function getGenericArray ($keyGroup) {
+       protected final function getGenericArray (string $keyGroup) {
                // Debug message
                //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup);
 
@@ -1579,9 +1579,6 @@ Loaded includes:
         * @return      $translated             Translated boolean value
         */
        public static final function translateBooleanToYesNo (bool $boolean) {
-               // Make sure it is really boolean
-               assert(is_bool($boolean));
-
                // "Translate" it
                $translated = ($boolean === true) ? 'Y' : 'N';
 
index 8aa0055faf6e4e531dbba02d1005e8cfcd6cda1c..64602350a65addc0dc3e109c0cf53614e636f0f7 100644 (file)
@@ -68,7 +68,7 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
         * @return      $streamData             The compressed stream data
         * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
-       public function compressStream ($streamData) {
+       public function compressStream (string $streamData) {
                // Validate parameter
                if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
@@ -86,7 +86,7 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
         * @return      $streamData             The decompressed stream data
         * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
-       public function decompressStream ($streamData) {
+       public function decompressStream (string $streamData) {
                // Validate parameter
                if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
index 20f997d15a3b483592720f1ef9880775e0c4a02c..7f7f9ca414d9709f45f89ab7344913a371f3ef38 100644 (file)
@@ -68,7 +68,7 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
         * @return      $streamData             The compressed stream data
         * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
-       public function compressStream ($streamData) {
+       public function compressStream (string $streamData) {
                // Validate parameter
                if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
@@ -86,7 +86,7 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
         * @return      $streamData             The decompressed stream data
         * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
-       public function decompressStream ($streamData) {
+       public function decompressStream (string $streamData) {
                // Validate parameter
                if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
index 58d6f0cdf1545ac10f4c4aaf4419155d1b3d6ca0..dd813fec294587dbc5cb958648246cfc61d5ab71 100644 (file)
@@ -62,7 +62,7 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
         * @return      $streamData             The compressed stream data
         * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
-       public function compressStream ($streamData) {
+       public function compressStream (string $streamData) {
                // Validate parameter
                if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
@@ -80,7 +80,7 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor {
         * @return      $streamData             The decompressed stream data
         * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
-       public function decompressStream ($streamData) {
+       public function decompressStream (string $streamData) {
                // Validate parameter
                if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
index ddd56a670f6d8ba96bda66d1f16adbd0bb1d2d5c..fc36c2b94c0a1291fefc8dc4d48e134d6855404f 100644 (file)
@@ -68,7 +68,7 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor {
         * @return      $streamData             The compressed stream data
         * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
-       public function compressStream ($streamData) {
+       public function compressStream (string $streamData) {
                // Validate parameter
                if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
@@ -86,7 +86,7 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor {
         * @return      $streamData             The decompressed stream data
         * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
-       public function decompressStream ($streamData) {
+       public function decompressStream (string $streamData) {
                // Validate parameter
                if (is_object($streamData) || is_resource($streamData)) {
                        // Throw an exception
index 39b94a2fce5b381e0142a8d267b574a527bd367b..49be57d6eb755c18deb57feaf86af1897753b18c 100644 (file)
@@ -97,7 +97,7 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
         * @param       $amount         Amount of points to store
         * @return      void
         */
-       public final function setAmount ($amount) {
+       public final function setAmount (float $amount) {
                $this->amount = (float) $amount;
        }
 
@@ -117,7 +117,7 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
         * @return      $hasRequired    Whether the user has the required points
         * @todo        Finish loading part of points
         */
-       public function ifUserHasRequiredPoints ($action) {
+       public function ifUserHasRequiredPoints (string $action) {
                // Default is that everyone is poor... ;-)
                $hasRequired = false;
 
@@ -146,7 +146,7 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
         * @param       $amount         Amount of points we shall book
         * @return      void
         */
-       public function bookPointsDirectly ($amount) {
+       public function bookPointsDirectly (float $amount) {
                // Rewind always
                $this->getResultInstance()->rewind();
 
index 3e467fe0ab432deffff9780c76d9f0614c2e923a..a8aa359d592320f57abe295ffbca854f8e4596e4 100644 (file)
@@ -35,7 +35,7 @@ interface Compressor extends FrameworkInterface {
         * @return      $streamData             The compressed stream data
         * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
-       function compressStream ($streamData);
+       function compressStream (string $streamData);
 
        /**
         * A decompression stream
@@ -44,7 +44,7 @@ interface Compressor extends FrameworkInterface {
         * @return      $streamData             The decompressed stream data
         * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
-       function decompressStream ($streamData);
+       function decompressStream (string $streamData);
 
        /**
         * Getter for the file extension of this compressor
index 7c072a2be65ef38ac530ca542b8811422b36e892..d35bdd7a15606e380a649069cc31b4a93a3e53a8 100644 (file)
@@ -34,7 +34,7 @@ interface BookablePoints extends AddableCriteria {
         * @param       $action                 The action or configuration entry plus prefix the user wants to perform
         * @return      $hasRequired    Whether the user has the required points
         */
-       function ifUserHasRequiredPoints ($action);
+       function ifUserHasRequiredPoints (string $action);
 
        /**
         * "Books" the given points amount on the current user's account
@@ -42,6 +42,6 @@ interface BookablePoints extends AddableCriteria {
         * @param       $amount         Amount of points we shall book
         * @return      void
         */
-       function bookPointsDirectly ($amount);
+       function bookPointsDirectly (float $amount);
 
 }