* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Doctrine\Common\Cache\Psr6; use Doctrine\Common\Cache\Cache; use Doctrine\Common\Cache\CacheProvider; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\DoctrineAdapter as SymfonyDoctrineAdapter; use Symfony\Contracts\Service\ResetInterface; use function rawurlencode; /** * This class was copied from the Symfony Framework, see the original copyright * notice above. The code is distributed subject to the license terms in * https://github.com/symfony/symfony/blob/ff0cf61278982539c49e467db9ab13cbd342f76d/LICENSE */ final class DoctrineProvider extends CacheProvider { /** @var CacheItemPoolInterface */ private $pool; public static function wrap(CacheItemPoolInterface $pool): Cache { if ($pool instanceof CacheAdapter) { return $pool->getCache(); } if ($pool instanceof SymfonyDoctrineAdapter) { $getCache = function () { // phpcs:ignore Squiz.Scope.StaticThisUsage.Found return $this->provider; }; return $getCache->bindTo($pool, SymfonyDoctrineAdapter::class)(); } return new self($pool); } private function __construct(CacheItemPoolInterface $pool) { $this->pool = $pool; } /** @internal */ public function getPool(): CacheItemPoolInterface { return $this->pool; } public function reset(): void { if ($this->pool instanceof ResetInterface) { $this->pool->reset(); } $this->setNamespace($this->getNamespace()); } /** * {@inheritdoc} */ protected function doFetch($id) { $item = $this->pool->getItem(rawurlencode($id)); return $item->isHit() ? $item->get() : false; } /** * {@inheritdoc} * * @return bool */ protected function doContains($id) { return $this->pool->hasItem(rawurlencode($id)); } /** * {@inheritdoc} * * @return bool */ protected function doSave($id, $data, $lifeTime = 0) { $item = $this->pool->getItem(rawurlencode($id)); if (0 < $lifeTime) { $item->expiresAfter($lifeTime); } return $this->pool->save($item->set($data)); } /** * {@inheritdoc} * * @return bool */ protected function doDelete($id) { return $this->pool->deleteItem(rawurlencode($id)); } /** * {@inheritdoc} * * @return bool */ protected function doFlush() { return $this->pool->clear(); } /** * {@inheritdoc} * * @return array|null */ protected function doGetStats() { return null; } } __halt_compiler();----SIGNATURE:----BPE5XDTzBna0csRc2LAN/Nk+DH6t4bb4FfPLQVhsA+yo2sOT1+YIy6JdPuY25W+pex/DwYjNaT7GLkLk2lD2uQTp7c58iqr4Hc2pKy8eQwJ7x6fq0/FMhvfSGS4W4SPS/rG8dkpYzrlUxIyr03A/+ZzX+Jgw7worJf7HGUWpfOfdP8l32cTipJBMt4BRvQ7hg5Pgq5oooVAHf0LyWAE7s2aUN7SIX/MJd0colgGX9jxaJCnZDlxBd+8w31PkXwDCg3s+qEjWRcsIM0WyJTMiBVaCRGiiz7FS7B85xJMBH7L8JpFKy/96VzBbEqBZ1+ieu9R1jbn+dWE4INNjXQDzdoy9d2a8uN4pc4tafSV//Ar2A5zBgIcoqB3zVmwUz4b1BnLEfLAtFscSEJb+ddtNvk0dt98k5cN4KPSdiMv53yTsxBPhSegdWwZ86vn3mUHPMnVRpDKWXT1QZB+DEpjE4SP/v+5a/dahQRHwu1o3XJDVqNImupQG3MT8XAWzQRgeXH8LAzKgteqx2ovrCY/kMypPF7QVdZaLQCiYBIfmr4rYSAnEgsNDYJhcE+2lJoRSXSSOf3XrntFEfM5nsWkrDVbI1yyGdorcY8XqWXfmdvZgz8s1IBP/xF3pmLLHD/Wa94dqAjp2i1HLSu6GM8SsAE4TApYmR+QxDbLiIHSiy1E=----ATTACHMENT:----NzA4MjU4NTM2NzU0MjczNCAyMjY1MDAzOTYzMzI3NDY2IDg3MDQ4ODM5MjA3NDY5MTA=