private function assertSchemaValid($schema)
{
if (null === $this->metaSchema) {
// The meta schema is obviously not validated. If we
// validate it against itself, we have an endless recursion
$this->metaSchema = json_decode(file_get_contents(__DIR__ . '/../res/meta-schema.json'));
}
if ($schema === $this->metaSchema) {
return;
}
$errors = $this->validate($schema, $this->metaSchema);
if (count($errors) > 0) {
throw new InvalidSchemaException(sprintf("The schema is invalid:\n%s", implode("\n", $errors)));
}
}