| 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 | 13 | protected function cacheBindingFor(string $interface, \Closure|string $concrete): void |
|
| 23 | { |
||
| 24 | 13 | $clue = 'binder_' . $this->classFolder; |
|
| 25 | |||
| 26 | 13 | $cache = cache()->get($clue); |
|
| 27 | |||
| 28 | 13 | $cache[$interface] = $concrete; |
|
| 29 | |||
| 30 | 13 | 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 |