public function read($filename) { Assertion::file($filename); $this->filename = $filename; $config = json_decode(file_get_contents($filename), true); if (json_last_error() !== JSON_ERROR_NONE) { throw InvalidConfigException::fromJSONFileError($filename, $this->getJsonError()); } return $config; }
public function testItCanBeCreatedWithAJSONFileError() { assertSame('Invalid JSON in "example.json": JSON Error Message', InvalidConfigException::fromJSONFileError('example.json', 'JSON Error Message')->getMessage()); }