Files
assets
data
dependencies
amphp
berlindb
composer
daverandom
delight-im
doctrine
guzzlehttp
hashids
ifsnop
jasny
kelunik
league
mexitek
mpdf
myclabs
nesbot
nyholm
pablo-sg-pacheco
paragonie
phpdocumentor
phpseclib
phpstan
psr
rakit
ralouphie
remotelyliving
rpnzl
scssphp
setasign
spatie
stripe
symfony
cache
Adapter
DataCollector
DependencyInjection
Exception
Marshaller
DefaultMarshaller.php
DeflateMarshaller.php
MarshallerInterface.php
SodiumMarshaller.php
TagAwareMarshaller.php
Messenger
Traits
CacheItem.php
DoctrineProvider.php
LockRegistry.php
PruneableInterface.php
Psr16Cache.php
ResettableInterface.php
cache-contracts
deprecation-contracts
event-dispatcher
event-dispatcher-contracts
polyfill-mbstring
polyfill-php73
polyfill-php80
polyfill-php81
process
service-contracts
translation
translation-contracts
var-exporter
webmozart
woocommerce
yahnis-elsts
autoload.php
scoper-autoload.php
inc
lang
views
.gitignore
LICENSE
autoload.php
composer.json
constants.php
loco.xml
readme.txt
sunrise.php
uninstall.php
wp-multisite-waas.php
wp-multisite-waas/dependencies/symfony/cache/Marshaller/DeflateMarshaller.php
2024-11-30 18:24:12 -07:00

47 lines
1.3 KiB
PHP

<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WP_Ultimo\Dependencies\Symfony\Component\Cache\Marshaller;
use WP_Ultimo\Dependencies\Symfony\Component\Cache\Exception\CacheException;
/**
* Compresses values using gzdeflate().
*
* @author Nicolas Grekas <p@tchwork.com>
*/
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);
}
}