1 | <?php |
||||
2 | |||||
3 | namespace Nip\Cache\CacheManager; |
||||
4 | |||||
5 | /** |
||||
6 | * Trait InteractsWithConfig |
||||
7 | * @package Nip\Cache\CacheManager |
||||
8 | */ |
||||
9 | trait InteractsWithConfig |
||||
10 | { |
||||
11 | /** |
||||
12 | * @param $name |
||||
13 | * @param null $default |
||||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||||
14 | * @return array|null |
||||
15 | */ |
||||
16 | protected function getConfigStore($name, $default = null) |
||||
0 ignored issues
–
show
The parameter
$default is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
17 | 2 | { |
|||
18 | return $this->getConfig('stores.' . $name, $default = null); |
||||
19 | 2 | } |
|||
20 | |||||
21 | /** |
||||
22 | * Get the filesystem connection configuration. |
||||
23 | * |
||||
24 | * @param string $name |
||||
25 | * @param null $default |
||||
0 ignored issues
–
show
|
|||||
26 | * @return array |
||||
27 | */ |
||||
28 | protected function getConfig($name, $default = null) |
||||
29 | 1 | { |
|||
30 | if (!function_exists('config') || !function_exists('app')) { |
||||
31 | 1 | return $default; |
|||
32 | } |
||||
33 | try { |
||||
34 | $config = config(); |
||||
35 | 1 | } catch (\Exception $e) { |
|||
36 | 1 | return $default; |
|||
37 | 1 | } |
|||
38 | $configName = "cache.{$name}"; |
||||
39 | if (!$config->has($configName)) { |
||||
40 | return $default; |
||||
41 | } |
||||
42 | |||||
43 | return $config->get($configName)->toArray(); |
||||
44 | } |
||||
45 | } |
||||
46 |