]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/compressor/class_ZlibCompressor.php
Continued:
[core.git] / framework / main / classes / compressor / class_ZlibCompressor.php
index 8992b4c30cac29d1485325d630a5ee8b043b7bda..a5db0382cf57d92a72486fe381bd82688972d222 100644 (file)
@@ -11,7 +11,7 @@ use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -34,7 +34,7 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor {
         *
         * @return      void
         */
-       protected function __construct () {
+       private function __construct () {
                // Call parent constructor!
                parent::__construct(__CLASS__);
        }
@@ -52,7 +52,7 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor {
                if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) {
                        // Compressor can maybe be used
                        $compressorInstance = new ZlibCompressor();
-               } // END - if
+               }
 
                // Return the compressor instance
                return $compressorInstance;
@@ -63,16 +63,13 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The compressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
         */
-       public function compressStream ($streamData) {
-               if (is_object($streamData)) {
-                       // Throw an exception
-                       throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               } // END - if
+       public function compressStream (string $streamData) {
+               // Compress string
+               $streamData = gzcompress($streamData, 1);
 
-               // Return the compressed stream
-               return gzcompress($streamData, 1);
+               // Return it
+               return $streamData;
        }
 
        /**
@@ -80,16 +77,13 @@ class ZlibCompressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The decompressed stream data
-        * @throws      InvalidObjectException  If the stream is an object
         */
-       public function decompressStream ($streamData) {
-               if (is_object($streamData)) {
-                       // Throw an exception
-                       throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
-               } // END - if
-
+       public function decompressStream (string $streamData) {
                // Return the decompressed stream
-               return gzuncompress($streamData);
+               $streamData = gzuncompress($streamData);
+
+               // Return it
+               return $streamData;
        }
 
        /**