Micro-PHP /
plugin-cache
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | /* |
||
| 6 | * This file is part of the Micro framework package. |
||
| 7 | * |
||
| 8 | * (c) Stanislau Komar <[email protected]> |
||
| 9 | * |
||
| 10 | * For the full copyright and license information, please view the LICENSE |
||
| 11 | * file that was distributed with this source code. |
||
| 12 | */ |
||
| 13 | |||
| 14 | namespace Micro\Plugin\Cache\Business\Pool; |
||
| 15 | |||
| 16 | use Micro\Plugin\Cache\Business\Adapter\AdapterFactoryInterface; |
||
| 17 | use Psr\Cache\CacheItemPoolInterface; |
||
| 18 | use Symfony\Component\Cache\Adapter\AbstractAdapter; |
||
|
0 ignored issues
–
show
|
|||
| 19 | use Symfony\Component\Cache\Adapter\Psr16Adapter; |
||
| 20 | use Symfony\Component\Cache\Psr16Cache; |
||
| 21 | |||
| 22 | class CachePool implements CachePoolInterface |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * @var array<string, CacheItemPoolInterface> |
||
| 26 | */ |
||
| 27 | private array $cacheItemsCollection; |
||
| 28 | |||
| 29 | 4 | public function __construct( |
|
| 30 | private readonly AdapterFactoryInterface $adapterFactory |
||
| 31 | ) { |
||
| 32 | 4 | $this->cacheItemsCollection = []; |
|
| 33 | } |
||
| 34 | |||
| 35 | 4 | public function getCachePsr16(string $cachePoolName): CacheItemPoolInterface |
|
| 36 | { |
||
| 37 | 4 | $cache = new Psr16Cache($this->getCachePsr6($cachePoolName)); |
|
| 38 | |||
| 39 | 4 | return new Psr16Adapter($cache); |
|
| 40 | } |
||
| 41 | |||
| 42 | 4 | public function getCachePsr6(string $cachePoolName): CacheItemPoolInterface |
|
| 43 | { |
||
| 44 | 4 | if (\array_key_exists($cachePoolName, $this->cacheItemsCollection)) { |
|
| 45 | 4 | return $this->cacheItemsCollection[$cachePoolName]; |
|
| 46 | } |
||
| 47 | |||
| 48 | 4 | $item = $this->adapterFactory->create($cachePoolName); |
|
| 49 | |||
| 50 | 4 | $this->cacheItemsCollection[$cachePoolName] = $item; |
|
| 51 | |||
| 52 | 4 | return $item; |
|
| 53 | } |
||
| 54 | |||
| 55 | 4 | public function getCacheSymfony(string $cachePoolName): AbstractAdapter |
|
| 56 | { |
||
| 57 | /** @var AbstractAdapter $item */ |
||
| 58 | 4 | $item = $this->getCachePsr16($cachePoolName); |
|
| 59 | |||
| 60 | 4 | return $item; |
|
| 61 | } |
||
| 62 | } |
||
| 63 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths