/** * Validate that an object schema meets the minimum requirements. * * @param LdapObjectSchema $schema * @throws SchemaParserException */ protected function validateObjectSchema($schema) { if (empty($schema->getAttributeMap())) { throw new SchemaParserException(sprintf('Object type "%s" has no attributes defined.', $schema->getObjectType())); } elseif (!(bool) count(array_filter(array_keys($schema->getAttributeMap()), 'is_string'))) { throw new SchemaParserException('The attributes for a schema should be an associative array.'); } if ($schema->getScope() && !in_array($schema->getScope(), QueryOperation::SCOPE)) { throw new SchemaParserException(sprintf('The scope "%s" is not valid. Valid types are: %s', $schema->getScope(), implode(', ', QueryOperation::SCOPE))); } }