Total Complexity | 2 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 62.5% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | trait CachesBindings |
||
11 | { |
||
12 | /** |
||
13 | * Cache the binding. |
||
14 | * |
||
15 | * @param string $interface |
||
16 | * @param \Closure|string $concrete |
||
17 | * |
||
18 | * @return void |
||
19 | * @throws ContainerExceptionInterface |
||
20 | * @throws NotFoundExceptionInterface |
||
21 | */ |
||
22 | 14 | protected function cacheBindingFor(string $interface, \Closure|string $concrete): void |
|
23 | { |
||
24 | 14 | $clue = static::CACHE_KEY . $this->classFolder; |
|
|
|||
25 | |||
26 | 14 | $cache = cache()->get($clue); |
|
27 | |||
28 | 14 | $cache[$interface] = $concrete; |
|
29 | |||
30 | 14 | cache()->put($clue, $cache); |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * Apply the caching. |
||
35 | * |
||
36 | * @param string $clue |
||
37 | * |
||
38 | * @return void |
||
39 | * @throws ContainerExceptionInterface |
||
40 | * @throws NotFoundExceptionInterface |
||
41 | */ |
||
42 | protected function applyCachingBy(string $clue): void |
||
46 | ); |
||
47 | } |
||
49 |