X-Git-Url: https://reisub.nsupdate.info/git/?p=friendica-addons.git%2F.git;a=blobdiff_plain;f=advancedcontentfilter%2Fvendor%2Fsymfony%2Fcache%2FMarshaller%2FDeflateMarshaller.php;fp=advancedcontentfilter%2Fvendor%2Fsymfony%2Fcache%2FMarshaller%2FDeflateMarshaller.php;h=5544806116893177ede1d968e9c5ece66b274490;hp=0000000000000000000000000000000000000000;hb=e0165b39bd9f1a105f28e17e75656ce88c5139ba;hpb=efdbab5100af7b5809ddc72319c32f3799adf1fa diff --git a/advancedcontentfilter/vendor/symfony/cache/Marshaller/DeflateMarshaller.php b/advancedcontentfilter/vendor/symfony/cache/Marshaller/DeflateMarshaller.php new file mode 100644 index 00000000..55448061 --- /dev/null +++ b/advancedcontentfilter/vendor/symfony/cache/Marshaller/DeflateMarshaller.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Cache\Marshaller; + +use Symfony\Component\Cache\Exception\CacheException; + +/** + * Compresses values using gzdeflate(). + * + * @author Nicolas Grekas + */ +class DeflateMarshaller implements MarshallerInterface +{ + private $marshaller; + + public function __construct(MarshallerInterface $marshaller) + { + if (!\function_exists('gzdeflate')) { + throw new CacheException('The "zlib" PHP extension is not loaded.'); + } + + $this->marshaller = $marshaller; + } + + /** + * {@inheritdoc} + */ + public function marshall(array $values, ?array &$failed): array + { + return array_map('gzdeflate', $this->marshaller->marshall($values, $failed)); + } + + /** + * {@inheritdoc} + */ + public function unmarshall(string $value) + { + if (false !== $inflatedValue = @gzinflate($value)) { + $value = $inflatedValue; + } + + return $this->marshaller->unmarshall($value); + } +}