* * 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:----IS7Ehj2Ds1EAwwmyieYuA6YjS7oz+ITwkhD5YWDdrRix10cPHrXGlOKnPkkfJ3HCur6Kgkp1fRNq4aav5pfstDdNLTj8D/LUu9X2/Cs6QSXnfenofAbjonxRJ2KIRpnZdlWmQIUKRJZpwLIHvhsRZFn8Wz8vvuq9mM5698NxiEIcU7ycix5qujNTi5WFcpMmT6pkF7D8zuchwE8b8W4ymDVzCmLtna0nkitWC8adi9Le0b95T7R60NE0VzYSPRnSLilP40GZnc1GPMQMROsb1GDSyFzTL4jp9SdXPsbEvWVYFnDk/GGG8xlA9FA1cRJQWy+K60zHcifVQZYr8sLLHf0wm40IvDQMpZ7olU3M7G66uPhw4Y8lI2KKvO7UJrHHRFqihFNlPKLwiDws+WRuPA4D+I+zVr9FJzzPqf/ilGhxbHvCwS2krkmcdLogo6EH2jgOZ/3VbenFvjCSMmIP0Kvz61MF3YH8diMGfdx3KFaE5xWZWqXIw2UU92+loeDSlhFtTO+nPrhKxKCWrMQHDAurZwbcEBy17QWkbbTUc30++DOdKRfGt9v56jjI9dfZNzf8cEpGrEZVCifvcKpl3D51DxGq4FZxNX/y7dHztmuC8GmK4/9DNjJ1tRd1Wdbsc0uU6veLWIQiiZd38HnkXzq/OXmDWqDsLcpHFiWOLIM=----ATTACHMENT:----ODE4MTE0NDA3MTgzMTkzOSAxODQxNTM5NDc3OTY4Mzc1IDEwODY1MTM2NzQyMzIxOTc=