Fetches a required unique attribute value from an LDAP entry.

@param Entry|null $entry
@param string     $attribute
556793
private function getAttributeValue(Entry $entry, $attribute)
    {
        if (!$entry->hasAttribute($attribute)) {
            throw new InvalidArgumentException(sprintf('Missing attribute "%s" for user "%s".', $attribute, $entry->getDn()));
        }

        $values = $entry->getAttribute($attribute);

        if (1 !== \count($values)) {
            throw new InvalidArgumentException(sprintf('Attribute "%s" has multiple values.', $attribute));
        }

        return $values[0];
    }
1321884
public function add($dn, array $entry)
    {
        if ($this->suppressErrors) {
            return @ldap_add($this->getConnection(), $dn, $entry);
        }

        return ldap_add($this->getConnection(), $dn, $entry);
    }
819581
public static String extractAttributeEmptyCheck(Entry entry, String attributeType) {
        Attribute attribute = entry.get(attributeType);
        Attribute emptyFlagAttribute = entry.get(SchemaConstants.EMPTY_FLAG_ATTRIBUTE);
        boolean empty = false;
        try {
            if (attribute != null) {
                return attribute.getString();
            } else if (emptyFlagAttribute != null) {
                empty = Boolean.valueOf(emptyFlagAttribute.getString());
            }
        } catch (LdapInvalidAttributeValueException e) {
            throw new ObjectClassViolationException(e);
        }
        return empty ? new String() : null;
    }
617651
public function setAttribute($attribute, $value)
    {
        if(is_null($value)) {
            unset($this->attributes[$attribute]);
        }
        else {
            $this->attributes[$attribute] = $value;
        }

        return $this;
    }
1366289
public function attribute($attribute, $value = null)
    {
        if (is_array($attribute)) {
            $this->attributes = array_merge($this->attributes, $attribute);
        } else {
            $this->attributes[$attribute] = (string) $value;
        }

        return $this;
    }
1173847
private function getPropertyFor($attribute, $property) {
    return $this->propertyExists($attribute, $property)
         ? $this->__attributes[$attribute][$property]
         : null;
  }
1247404
public function input($attribute=null) {
		if($attribute)
			return $this->attribute($attribute)->input();
		return $this->input;
	}
1050421
protected function resolveAttribute($resource, $attribute)
    {
        $this->setResourceId(data_get($resource, 'id'));
        return parent::resolveAttribute($resource, $attribute);
    }
643400
function attribute( $attribute )
    {
        if ( $attribute == 'info' )
        {
            return $this->Info;
        }
        else if ( $attribute == 'notification_types' )
        {
            return $this->notificationTypes();
        }

        eZDebug::writeError( "Attribute '$attribute' does not exist", __METHOD__ );
        return null;
    }
520675
protected function takeAttributeFromDOM($attribute)
    {
        switch ($attribute->localName) {
        case 'url':
            $this->_url = $attribute->nodeValue;
            break;
        default:
            parent::takeAttributeFromDOM($attribute);
        }
    }
552844
protected function validateAttribute (string $attribute=NULL) : bool
	{
		if (!property_exists($this, $attribute))
		{
			$this->error = "Attribute: ".ucfirst($attribute)." is not a class object.";
        	return FALSE;
		}
        $result = (is_array($this->$attribute)) ? !empty($this->$attribute) : Validate::hasValue($this->$attribute);
        if ($result) return TRUE;
		$this->error = "Set ".ucfirst($attribute)." to log your message.";
    	return FALSE;
	}
667366
private function createNode($name, $entry = null, $entryAttribute = null)
    {
        $document = $this->getDocument();

        try {
            $node = $document->createElement($name);
        } catch (\DOMException $e) {
            $node = $document->createElement($entry ?: $this->entry);

            if (is_string($name)) {
                $node->setAttribute($entryAttribute ?: $this->entryAttribute, $name);
            }
        }

        return $node;
    }
802661
public function getAttribute($attribute) {
		if (isset($this->_attributes[$attribute])) {
			return $this->_attributes[$attribute];
		}

		return null;
	}
213073
protected function setRequirementsForAttribute($attribute, array $value)
    {
        $parameters = [];

        foreach ($value as $attrValue) {
            $parameters = array_filter(array_merge(
                $parameters,
                self::getParametersInValue($attrValue)
            ));
        }

        if (!empty($parameters)) {
            $this->requirements[$attribute] = $parameters;
        }
    }
421713
public function getAttributeValues($entry)
    {
        $r = $this->entityManager->getRepository('\Concrete\Core\Entity\Attribute\Value\ExpressValue');
        $values = $r->findBy([
            'entry' => $entry,
        ]);

        return $values;
    }
867044
protected function loadUser($username, Entry $entry)
    {
        $password = null;

        if (null !== $this->passwordAttribute) {
            $password = $this->getAttributeValue($entry, $this->passwordAttribute);
        }

        return new User($username, $password, $this->defaultRoles);
    }
1244163
function get_entry($dn, $attributes = array())
    {
        return parent::get_entry($dn, !empty($attributes) ? $attributes : $this->attributes);
    }