public static function parse($json)
{
$data = json_decode($json, true);
if ($data === null) {
throw new Exception('Error parsing JSON response: ' . self::$_errors[json_last_error()] . '.');
}
return $data;
}
/** * Loads configuration from an array or a file. * * @param array|string $config A configuration array, or a JSON * configuration file. */ public function load($config) { if (is_string($config) && file_exists($config)) { $json = file_get_contents($config); $config = Json::parse($json); } $this->configure($config); }