docodeit /
wechat
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * This file is part of the docodeit/wechat. |
||
| 5 | * |
||
| 6 | * (c) docodeit <[email protected]> |
||
| 7 | * |
||
| 8 | * This source file is subject to the MIT license that is bundled |
||
| 9 | * with this source code in the file LICENSE. |
||
| 10 | */ |
||
| 11 | |||
| 12 | namespace JinWeChat\Kernel\Traits; |
||
| 13 | |||
| 14 | use JinWeChat\Kernel\ServiceContainer; |
||
| 15 | use Psr\SimpleCache\CacheInterface; |
||
| 16 | use Symfony\Component\Cache\Simple\FilesystemCache; |
||
|
0 ignored issues
–
show
|
|||
| 17 | |||
| 18 | /** |
||
| 19 | * Trait InteractsWithCache. |
||
| 20 | * |
||
| 21 | * @author docodeit <[email protected]> |
||
| 22 | */ |
||
| 23 | trait InteractsWithCache |
||
| 24 | { |
||
| 25 | /** |
||
| 26 | * @var \Psr\SimpleCache\CacheInterface |
||
| 27 | */ |
||
| 28 | protected $cache; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Get cache instance. |
||
| 32 | * |
||
| 33 | * @return \Psr\SimpleCache\CacheInterface |
||
| 34 | */ |
||
| 35 | public function getCache() |
||
| 36 | { |
||
| 37 | if ($this->cache) { |
||
| 38 | return $this->cache; |
||
| 39 | } |
||
| 40 | |||
| 41 | if (property_exists($this, 'app') && $this->app instanceof ServiceContainer |
||
| 42 | && isset($this->app['cache']) && $this->app['cache'] instanceof CacheInterface) { |
||
| 43 | return $this->cache = $this->app['cache']; |
||
| 44 | } |
||
| 45 | |||
| 46 | return $this->cache = $this->createDefaultCache(); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Set cache instance. |
||
| 51 | * |
||
| 52 | * @param \Psr\SimpleCache\CacheInterface $cache |
||
| 53 | * |
||
| 54 | * @return $this |
||
| 55 | */ |
||
| 56 | public function setCache(CacheInterface $cache) |
||
| 57 | { |
||
| 58 | $this->cache = $cache; |
||
| 59 | |||
| 60 | return $this; |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @return \Symfony\Component\Cache\Simple\FilesystemCache |
||
| 65 | */ |
||
| 66 | protected function createDefaultCache() |
||
| 67 | { |
||
| 68 | return new FilesystemCache(); |
||
| 69 | } |
||
| 70 | } |
||
| 71 |
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