LdapTools\Schema\Parser\SchemaYamlParser::getObjectFromSchema PHP Method

getObjectFromSchema() protected method

Check for a specific object type in the schema and validate it.
protected getObjectFromSchema ( array $schema, string $objectType ) : array
$schema array
$objectType string
return array
    protected function getObjectFromSchema(array $schema, $objectType)
    {
        $objectSchema = null;
        foreach ($schema['objects'] as $ldapObject) {
            if (array_key_exists('type', $ldapObject) && MBString::strtolower($ldapObject['type']) == MBString::strtolower($objectType)) {
                $objectSchema = $ldapObject;
            }
        }
        if (is_null($objectSchema)) {
            throw new SchemaParserException(sprintf('Cannot find object type "%s" in schema.', $objectType));
        }
        return $objectSchema;
    }