]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/compressor/class_GzipCompressor.php
Continued:
[core.git] / framework / main / classes / compressor / class_GzipCompressor.php
index 3ab0b13f6d6eee455d1790ccd36a273d96a25de6..d8446a8d0d41760aa6bd9d17785e37bfc73cb876 100644 (file)
@@ -6,9 +6,6 @@ namespace Org\Mxchange\CoreFramework\Compressor\Gzip;
 use Org\Mxchange\CoreFramework\Compressor\Compressor;
 use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 
-// Load SPL stuff
-use \InvalidArgumentException;
-
 /**
  * GZIP compression and decompression class
  *
@@ -66,17 +63,13 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The compressed stream data
-        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        public function compressStream (string $streamData) {
-               // Validate parameter
-               if (is_object($streamData) || is_resource($streamData)) {
-                       // Throw an exception
-                       throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData)));
-               }
+               // Compress stream
+               $streamData = gzencode($streamData, 1);
 
-               // Return the compressed stream
-               return gzencode($streamData, 1);
+               // Return it
+               return $streamData;
        }
 
        /**
@@ -84,17 +77,13 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor {
         *
         * @param       $streamData             Mixed non-object stream data
         * @return      $streamData             The decompressed stream data
-        * @throws      InvalidArgumentException        If the stream is not compressable or decompressable
         */
        public function decompressStream (string $streamData) {
-               // Validate parameter
-               if (is_object($streamData) || is_resource($streamData)) {
-                       // Throw an exception
-                       throw new InvalidArgumentException(sprintf('streamData[]=%s cannot be compressed/decompressed', gettype($streamData)));
-               }
+               // Decompress string
+               $streamData = gzdecode($streamData);
 
-               // Return the decompressed stream
-               return gzdecode($streamData);
+               // Return it
+               return $streamData;
        }
 
        /**