LdapTools\Query\LdapQuery::getSingleScalarResult PHP Метод

getSingleScalarResult() публичный Метод

Retrieve a single selected attribute value from LDAP.
public getSingleScalarResult ( ) : mixed
Результат mixed
    public function getSingleScalarResult()
    {
        if (count($this->operation->getAttributes()) !== 1 || $this->isWildCardSelection()) {
            $selected = $this->isWildCardSelection() ? 'All' : count($this->operation->getAttributes());
            throw new LdapQueryException(sprintf('When retrieving a single value you should only select a single attribute. %s are selected.', $selected));
        }
        $attribute = $this->operation->getAttributes();
        $attribute = reset($attribute);
        $result = $this->getSingleResult();
        if (!$result->has($attribute)) {
            throw new AttributeNotFoundException(sprintf('Attribute "%s" not found for this LDAP object.', $attribute));
        }
        return $result->get($attribute);
    }