@param string $compression

@return DeCompressorInterface
@throws InvalidCompressionTypeException
6588
public function getDeCompressor($compression)
    {
        if (isset($this->deCompressors[$compression])) {
            return $this->deCompressors[$compression];
        } else {
            throw new InvalidCompressionTypeException($compression);
        }
    }
562846
protected function compressInt($type, $val)
    {
        $newType = $type;

        if ($val >= 0) {
            // Convert to unsigned
            switch ($newType) {
                case self::BINN_INT64:
                    $newType = self::BINN_UINT64;
                    break;

                case self::BINN_INT32:
                    $newType = self::BINN_UINT32;
                    break;

                case self::BINN_INT16:
                    $newType = self::BINN_UINT16;
                    break;

                case self::BINN_INT8:
                    $newType = self::BINN_UINT8;
                    break;
            }
        }

        if (in_array($newType, [self::BINN_INT64, self::BINN_INT32, self::BINN_INT16])) {
            // Signed
            if ($val >= self::INT8_MIN) {
                $newType = self::BINN_INT8;
            }
            elseif ($val >= self::INT16_MIN) {
                $newType = self::BINN_INT16;
            }
            elseif ($val >= self::INT32_MIN) {
                $newType = self::BINN_INT32;
            }
        }

        if (in_array($newType, [self::BINN_UINT64, self::BINN_UINT32, self::BINN_UINT16])) {
            // Unsigned

            if ($val <= self::UINT8_MAX) {
                $newType = self::BINN_UINT8;
            }
            elseif ($val <= self::UINT16_MAX) {
                $newType = self::BINN_UINT16;
            }
            elseif ($val <= self::UINT32_MAX) {
                $newType = self::BINN_UINT32;
            }
        }

        return $newType;
    }
184499
public function asPng($compression = 9)
    {
        ob_start();

        $im = $this->output();
        imagepng($im, null, $compression);

        return ob_get_clean();
    }
1027356
protected function _compress($content, $ext) {
		$compress = $this->getConfig('compress');
		if ($compress === true) {
			// Native compressor only supports HTML right now
			if ($ext === 'html') {
				$Compressor = new Compressor();
				$content = $Compressor->compress($content);
			}
		} elseif (is_callable($compress)) {
			$content = $compress($content, $ext);
		} elseif ($compress) {
			$content = call_user_func($compress, $content, $ext);
		}

		return $content;
	}
336321
protected byte[] decompress(byte[] in) {
    switch (this.compressMode) {
      case GZIP:
        return gzipDecompress(in);
      case ZIP:
        return zipDecompress(in);
      default:
        return gzipDecompress(in);
    }
  }
391025
public static function ungzip( $content )
	{
		if( function_exists( 'gzdecode' ) )															//  if PHP method has been released
			$content	= @gzdecode( $content );													//  use it to decompress the data
		else																						//  otherwise: own implementation
		{
			$tmp	= tempnam( '/tmp', 'CMC' );														//  create temporary file
			@file_put_contents( $tmp, $content );													//  store gzipped data
			ob_start();																				//  open output buffer
			readgzfile( $tmp );																		//  read the gzip file to std output
			@unlink( $tmp );
			$content	= ob_get_clean();															//  get decompressed data from output buffer
		}
		if( FALSE !== $content )																	//  gzencode could decompress
			return $content;																			//  return decompressed data
		throw new RuntimeException( 'Data not decompressable with gzdecode' );						//  throw exception
	}
825259
public function addCompressor(CompressionTypeInterface $type)
    {
        if ($type instanceof CompressorInterface) {
            $this->compressors[$type->getName()] = $type;
        }
        if ($type instanceof DeCompressorInterface) {
            $this->deCompressors[$type->getName()] = $type;
        }

        return $this;
    }
1100167
public static function createCompressionManager(array $methods)
    {
        $compression_manager = new CompressionManager();

        foreach ($methods as $key => $value) {
            if ($value instanceof CompressionInterface) {
                $compression_manager->addCompressionAlgorithm($value);
            } elseif (is_string($value)) {
                $class = self::getMethodClass($value);
                $compression_manager->addCompressionAlgorithm(new $class());
            } else {
                $class = self::getMethodClass($key);
                $compression_manager->addCompressionAlgorithm(new $class($value));
            }
        }

        return $compression_manager;
    }
812088
public function bytecode($bytecode)
    {
        if (HexValidator::validate($bytecode) === false) {
            throw new InvalidArgumentException('Please make sure bytecode is valid.');
        }
        $this->bytecode = Utils::stripZero($bytecode);

        return $this;
    }
617072
public function create(array $aliases): CompressionMethodManager
    {
        $compressionMethods = [];
        foreach ($aliases as $alias) {
            if (\array_key_exists($alias, $this->compressionMethods)) {
                $compressionMethods[] = $this->compressionMethods[$alias];
            } else {
                throw new \InvalidArgumentException(\sprintf('The compression method with the alias "%s" is not supported.', $alias));
            }
        }

        return CompressionMethodManager::create($compressionMethods);
    }
50067
public function compress($content)
    {
        $archive = $this->getArchive();
        if (!empty($archive)) {
            $file = gzopen($archive, 'w' . $this->getLevel());
            if (!$file) {
                throw new Exception\RuntimeException("Error opening the archive '" . $this->options['archive'] . "'");
            }

            gzwrite($file, $content);
            gzclose($file);
            $compressed = true;
        } elseif ($this->options['mode'] == 'deflate') {
            $compressed = gzdeflate($content, $this->getLevel());
        } else {
            $compressed = gzcompress($content, $this->getLevel());
        }

        if (!$compressed) {
            throw new Exception\RuntimeException('Error during compression');
        }

        return $compressed;
    }
224122
protected function compressInlineJsonCode($json)
    {
        if (!($json = (string) $json)) {
            return $json; // Nothing to do.
        }
        if (($compressed_json = \WebSharks\JsMinifier\Core::compress($json))) {
            return '/*<![CDATA[*/'.$compressed_json.'/*]]>*/';
        }
        return $json;
    }
368514
protected function getUncompressed($compressed)
    {
        $decompressed = $this->_gzdecode($compressed);

        if ($decompressed === false) {

            throw new ehough_shortstop_api_exception_RuntimeException('Could not decompress data with simulated gzdecode()');
        }

        return $decompressed;
    }
1112982
public function prepend($prefix): Utility
    {
        return new static(new static($prefix, $this->encoding) . $this->string, $this->encoding);
    }
793913
protected function compressFile($filepath)
	{
		if (!$this->getBackupFilesystemInstance()->checkFunctionExists('gzencode')) {
			throw new BackupException('The method: "gzencode" isn\'t currently enabled.');
		}

		$compressedFilepath = $this->getCompressedFilepath($filepath);
		$this->getBackupFilesystemInstance()->writeCompressedFile($compressedFilepath, $filepath);
		$this->getBackupFilesystemInstance()->removeFile($filepath);

		return $compressedFilepath;
	}
537067
private function decorateStream(string $encoding, StreamInterface $stream)
    {
        if ('chunked' === strtolower($encoding)) {
            return new Encoding\DechunkStream($stream);
        }

        if ('deflate' === strtolower($encoding)) {
            return new Encoding\DecompressStream($stream);
        }

        if ('gzip' === strtolower($encoding)) {
            return new Encoding\GzipDecodeStream($stream);
        }

        return false;
    }
153583
public static function compressString( $content, $type = NULL )
	{
		switch( $type )
		{
			case NULL:
				return $content;
			case 'deflate':
				return gzdeflate( $content );														//  compress Content
			case 'gzip':
				return gzencode( $content, 9 );														//  compress Content
			default:																				//  no valid Compression Method set
				throw new InvalidArgumentException( 'Compression "'.$type.'" is not supported' );
		}
	}