/** * @param SchemaId $schemaId * @param array $curies * * @return array * * @throws \InvalidArgumentException * @throws MissingSchema */ private function getAnyOf($schemaId, $curies) { if (in_array($schemaId->getCurie(), $curies)) { throw new \InvalidArgumentException(sprintf('Cannot add yourself "%s" as to anyof.', $schemaId->toString())); } $schemas = []; foreach ($curies as $curie) { if (!($schema = SchemaStore::getSchemaById($curie, true))) { throw new MissingSchema($curie); } $schemas[] = $schema; } return $schemas; }