src/LdapTools/Query/LdapQuery.php
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);
    }
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);
    }
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 ) ; }
Retrieve a single selected attribute value from LDAP.

@return mixed
@throws LdapQueryException
@throws AttributeNotFoundException
@throws EmptyResultException
@throws MultiResultException
Retrieve a single selected attribute value from LDAP .