* * 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:----egF8lqO6osGzEpvlm/g3J485n3a762qrlzpIw8U1vKChzSh7441bpqP7fMPRN7N9Z6HgkipglWMU5Vn1RnKd611RfnBhTphN6IHpzEW4Fp7Bo7pyDD4ifv3l9pGfkIb4dLl9GRp6FwktBOXfTw2umPPuJS/SQmgN7NhI1wRLCbXjgMP1qyEpJNE8sYZ/ZVEfRbmM9bvK1Ve+2V9kvfgdcmoCGYDSLxj/CbdKzAkvwC+HWfiwCUqBldF+k7IWM2Kq3S5FVi05pQeAJPEEiOw6fmMKt2Un2bR3ehDC4Aq/l+5/fYQQB/qLl0LhjkI5Z+a+xpKBfFZ2rcENMdxzjEJuANu0Cw4tdDwdtSShPJkOdvnC1OEbL3eGOpbbxmFK1JQnc97oT8i7Rb4gJ/xevP/cnMav8PFDAqBTcnQ7RLfnxBfvg7j0oMl2bTwD047cA+Y84d1gsQfIx8iB1QrOValyONO0lh0rKD4ykPlfJ1Kjeg6E/ZsCNXUgeNcr8i9DAhDQgAozD+8qp104Q/6HwWVaReFA8DxBnKl9Y5vAd6u4JufyeKucwsA5Cd3RYoL6sxMJehTV0fCn69UOXGP5R93LCUT3zeoEZBcLCMstijnTB7K+CKEvDzVSjGqzHonNs6QI8K5DEQtSpRgK6oC3ZxgVRXfvhnzi3tZI3xZ91fK/bvo=----ATTACHMENT:----NjE2OTE0NjcxNTc5ODc0OCA4NjQ0MTkyMzEwOTY4ODIzIDcxMTE4NjA4OTM4MDc1NjE=