1 | <?php |
||
2 | |||
3 | |||
4 | use League\Flysystem\Cached\Storage\AbstractCache; |
||
0 ignored issues
–
show
|
|||
5 | use Psr\SimpleCache\CacheInterface; |
||
6 | |||
7 | /** |
||
8 | * Class Cache |
||
9 | * @package Nip\Filesystem |
||
10 | */ |
||
11 | class Cache extends AbstractCache |
||
12 | { |
||
13 | /** |
||
14 | * The cache repository implementation. |
||
15 | * |
||
16 | * @var \Psr\SimpleCache\CacheInterface |
||
17 | */ |
||
18 | protected $repository; |
||
19 | |||
20 | /** |
||
21 | * The cache key. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $key; |
||
26 | |||
27 | /** |
||
28 | * The cache expiration time in seconds. |
||
29 | * |
||
30 | * @var int|null |
||
31 | */ |
||
32 | protected $expire; |
||
33 | |||
34 | /** |
||
35 | * Create a new cache instance. |
||
36 | * |
||
37 | * @param \Psr\SimpleCache\CacheInterface $repository |
||
38 | * @param string $key |
||
39 | * @param int|null $expire |
||
40 | * @return void |
||
41 | */ |
||
42 | public function __construct(CacheInterface $repository, $key = 'flysystem', $expire = null) |
||
43 | { |
||
44 | $this->key = $key; |
||
45 | $this->expire = $expire; |
||
46 | $this->repository = $repository; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Load the cache. |
||
51 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | public function load() |
||
55 | { |
||
56 | $contents = $this->repository->get($this->key); |
||
57 | |||
58 | if (!is_null($contents)) { |
||
59 | $this->setFromStorage($contents); |
||
60 | } |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Persist the cache. |
||
65 | * |
||
66 | * @return void |
||
67 | */ |
||
68 | public function save() |
||
69 | { |
||
70 | $contents = $this->getForStorage(); |
||
71 | |||
72 | $this->repository->set($this->key, $contents, $this->expire); |
||
73 | } |
||
74 | } |
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