public function addLdapObjectSchema(LdapObjectSchema $schema, $alias = null)
{
if (!is_null($alias) && !is_string($alias)) {
throw new InvalidArgumentException(sprintf('The alias for type "%s" must be a string, but "%s" was given.', $schema->getObjectType(), is_string($alias) ? $alias : gettype($alias)));
}
$alias = $alias ?: $schema->getObjectType();
if (!preg_match(self::ALIAS_REGEX, $alias)) {
throw new InvalidArgumentException(sprintf('The alias "%s" for type "%s" is invalid. Allowed characters are: A-Z, a-z, 0-9, -, _', $alias, $schema->getObjectType()));
}
$this->aliases[$alias] = $schema;
}