| Total Complexity | 3 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | class Php implements ConfigurationInterface |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | private string $filePath; |
||
| 26 | |||
| 27 | 12 | use CommonDriverMethods; |
|
| 28 | |||
| 29 | 12 | /** |
|
| 30 | 12 | * Creates a Php configuration driver |
|
| 31 | 3 | * |
|
| 32 | 3 | * @param string $filePath |
|
| 33 | 3 | */ |
|
| 34 | public function __construct(string $filePath) |
||
| 35 | 9 | { |
|
| 36 | $this->checkFile($filePath); |
||
| 37 | |||
| 38 | $this->filePath = $filePath; |
||
| 39 | $this->loadSettings(); |
||
| 40 | |||
| 41 | if (!is_array($this->data)) { |
||
| 42 | throw new ParserErrorException( |
||
| 43 | "Configuration file $this->filePath could not be parse as an array. ". |
||
| 44 | "PHP Settings file should be a script that returns an array." |
||
| 45 | ); |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Loads settings from php array in file |
||
| 51 | */ |
||
| 52 | private function loadSettings(): void |
||
| 57 | } |
||
| 58 | } |
||
| 59 |