getSearchPaths(); $dataPath = null; foreach($paths as $path) { if (file_exists($path)) { $dataPath = $path; break; } } if ($dataPath === null) { throw new Exception('Cannot find data file. Please check getPaths() implementation.'); } $data = json_decode(file_get_contents($dataPath), true); if (!is_array($data)) { throw new Exception('Cannot decode json from data file.'); } return $data; } /** * @return array */ public function getSearchPaths() { return $this->searchPaths; } /** * @param array|string $path */ public function setSearchPaths($path) { $this->searchPaths = (array)$path; } }