| @@ 45-57 (lines=13) @@ | ||
| 42 | * |
|
| 43 | * @param string $filePath |
|
| 44 | */ |
|
| 45 | public function __construct($filePath) |
|
| 46 | { |
|
| 47 | $this->checkFile($filePath); |
|
| 48 | $this->filePath = $filePath; |
|
| 49 | ||
| 50 | $this->loadSettings($filePath); |
|
| 51 | ||
| 52 | if (!is_array($this->data)) { |
|
| 53 | throw new ParserErrorException( |
|
| 54 | "Parse error: {$this->lastError}" |
|
| 55 | ); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| 59 | private function loadSettings($filePath) |
|
| 60 | { |
|
| @@ 34-47 (lines=14) @@ | ||
| 31 | * |
|
| 32 | * @param $filePath |
|
| 33 | */ |
|
| 34 | public function __construct($filePath) |
|
| 35 | { |
|
| 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 |
|