private function check($configFile)
{
$content = file_get_contents($configFile);
$parser = new JsonParser();
$result = $parser->lint($content);
if (null === $result) {
if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
throw new \UnexpectedValueException('"' . $configFile . '" is not UTF-8, could not parse as JSON');
}
$data = json_decode($content);
$schemaFile = __DIR__ . '/../../../res/satis-schema.json';
$schema = json_decode(file_get_contents($schemaFile));
$validator = new Validator();
$validator->check($data, $schema);
if (!$validator->isValid()) {
$errors = [];
foreach ((array) $validator->getErrors() as $error) {
$errors[] = ($error['property'] ? $error['property'] . ' : ' : '') . $error['message'];
}
throw new JsonValidationException('The json config file does not match the expected JSON schema', $errors);
}
return true;
}
throw new ParsingException('"' . $configFile . '" does not contain valid JSON' . "\n" . $result->getMessage(), $result->getDetails());
}