| Total Complexity | 2 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | trait Configurable |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * ConfigRepository instance. |
||
| 15 | * |
||
| 16 | * @var \FigTree\Config\Contracts\ConfigRepositoryInterface |
||
| 17 | */ |
||
| 18 | protected ConfigRepositoryInterface $configRepo; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Set the Config instance. |
||
| 22 | * |
||
| 23 | * @param \FigTree\Config\Contracts\ConfigRepositoryInterface $configRepo |
||
| 24 | * |
||
| 25 | * @return $this |
||
| 26 | */ |
||
| 27 | public function setConfigRepository(ConfigRepositoryInterface $configRepo) |
||
| 28 | { |
||
| 29 | $this->configRepo = $configRepo; |
||
| 30 | |||
| 31 | return $this; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Shorthand to either get the associated Config instance or the given |
||
| 36 | * top-level key from the Config file. |
||
| 37 | * |
||
| 38 | * @param string $fileName |
||
| 39 | * |
||
| 40 | * @return \FigTree\Config\Contracts\ConfigInterface |
||
| 41 | */ |
||
| 42 | protected function config(string $fileName): ConfigInterface |
||
| 45 | } |
||
| 46 | } |
||
| 47 |