| 1 | <?php |
||
| 10 | class FileUtility extends AbstractUtility |
||
| 11 | { |
||
| 12 | const EMPTY_FILE_PATH_MESSAGE = 'File path is empty'; |
||
| 13 | const MISSING_FILE_MESSAGE = 'File does not exist or is not a file'; |
||
| 14 | const INVALID_JSON_FILE_MESSAGE = 'File is not a json file'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Validate and convert a (JSON) file content to a PHP array. |
||
| 18 | * |
||
| 19 | * @param $filePath |
||
| 20 | * |
||
| 21 | * @throws \Exception |
||
| 22 | * |
||
| 23 | * @return array|mixed |
||
| 24 | */ |
||
| 25 | 24 | public function jsonFileToArray(string $filePath) |
|
| 41 | } |
||
| 42 |