LdapTools\AttributeConverter\ConvertValueToDn::getDnFromValue PHP Method

getDnFromValue() protected method

Given a value try to determine how to get its full distinguished name.
protected getDnFromValue ( string $value ) : string
$value string
return string $dn
    protected function getDnFromValue($value)
    {
        $options = $this->getOptionsArray();
        $toSelect = isset($options['select']) ? $options['select'] : 'dn';
        if ($value instanceof LdapObject && !$value->has($toSelect)) {
            throw new AttributeConverterException(sprintf('The LdapObject must have a "%s" defined when used in "%s".', $toSelect, $this->getAttribute()));
        } elseif ($value instanceof LdapObject) {
            $value = $value->get($toSelect);
        } elseif (!LdapUtilities::isValidLdapObjectDn($value) && !is_null($this->getLdapConnection())) {
            $value = $this->getAttributeFromLdapQuery($value, $toSelect);
        }
        return $value;
    }