/*!
Sets the attribute named \a $attributeName to have the value \a $attributeValue.

The following attributes can be set:
- alternative text
- original_filename
517129
function setAttribute( $attributeName, $attributeValue )
    {
        if ( in_array( $attributeName,
                       array( 'alternative_text',
                              'original_filename' ) ) )
        {
            $aliasList = $this->aliasList();
            foreach ( array_keys( $aliasList ) as $aliasName )
            {
                $this->setAliasAttribute( $aliasName, $attributeName, $attributeValue );
            }
            if ( $attributeName == 'alternative_text' )
            {
                $text = $this->displayText( $attributeValue );
                foreach ( array_keys( $aliasList ) as $aliasName )
                {
                    $this->setAliasAttribute( $aliasName, 'text', $text );
                }
            }
            $this->recreateDOMTree();
            $this->setStorageRequired();
            return true;
        }
        return false;
    }
415528
public function setNewValue($attribute, $value)
    {
        $this->assertValidAttribute($attribute);

        $this->documentChangeSet[$attribute][1] = $value;
        $this->getDocumentManager()->getUnitOfWork()->setDocumentChangeSet($this->getDocument(), $this->documentChangeSet);
    }
529404
public function initializeObjectAttribute($objectAttribute, $currentVersion, $originalContentObjectAttribute)
    {
        $value = $currentVersion != false ?
            $originalContentObjectAttribute->content() :
            $this->fieldType->getEmptyValue();

        $objectAttribute->setContent($value);
    }
1226031
protected function setFilename() {
    if (is_object($this->file)) {
      if (!isset($this->file->{$this->filename_field})) {
        return FALSE;
      }

      $this->file_name = $this->file->{$this->filename_field};
      return TRUE;
    }

    if (is_array($this->file)) {
      $this->file_name = $field[$this->filename_field];
      return TRUE;
    }

    if (is_string($this->file)) {
      $this->file_name = $this->file;
      return TRUE;
    }

    return FALSE;
  }
994179
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
    {
        if ( $currentVersion == false )
        {
            $contentObjectAttribute->setAttribute( 'data_int', 0 );
        }
        else if (  $contentObjectAttribute->attribute( 'id' ) != 0  )
        {
            if ( $originalContentObjectAttribute->attribute( 'data_int' ) != 0 )
            {
                $gmapObject = $originalContentObjectAttribute->attribute( 'content' );
                $gmapObject->setAttribute( 'contentobject_attribute_id', $contentObjectAttribute->attribute( 'id' ) );//in case of copy
                $gmapObject->setAttribute( 'contentobject_version', $contentObjectAttribute->attribute( 'version' ) );
                $contentObjectAttribute->setContent( $gmapObject );
                $contentObjectAttribute->store();
            }
        }
    }
956273
function title( $contentObjectAttribute, $name = "name" )
    {
        $option = $contentObjectAttribute->content( );

        $value = $option->attribute( $name );

        return $value;
    }
1356679
function SetButtonAttribute($optValue, $attribute, $value) {
        if (!isset($this->fieldAttributes[$optValue])) {
            $this->fieldAttributes[$optValue] = array();
        }
        $this->fieldAttributes[$optValue][$attribute] = $value;
    }
852928
public function setIsMultilingualAttributeAvValue($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->is_multilingual_attribute_av_value !== $v) {
            $this->is_multilingual_attribute_av_value = $v;
            $this->modifiedColumns[AttributeTypeTableMap::IS_MULTILINGUAL_ATTRIBUTE_AV_VALUE] = true;
        }


        return $this;
    }
1293733
public function hasAttributeValueByName($attributeValueName)
    {
        /** @var AttributeValueInterface $attributeValue */
        foreach ($this->attributeValues as $attributeValue) {
            if ($attributeValue->getAttributeName() == $attributeValueName) {
                return true;
            }
        }

        return false;
    }
1257289
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
    {
        if ( $currentVersion == false )
        {
            $option = $contentObjectAttribute->content();
            $contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
            if ( !$option )
            {
                $option = new eZRangeOption( $contentClassAttribute->attribute( 'data_text1' ) );
            }
            else
            {
                $option->setName( $contentClassAttribute->attribute( 'data_text1' ) );
            }
            $contentObjectAttribute->setAttribute( "data_text", $option->xmlString() );
            $contentObjectAttribute->setContent( $option );
        }
    }
516575
function SetCheckboxAttribute($optValue, $attribute, $value) {
        if (!isset($this->fieldAttributes[$optValue])) {
            $this->fieldAttributes[$optValue] = array();
        }
        $this->fieldAttributes[$optValue][$attribute] = $value;
    }
965644
function attribute( $name )
    {
        switch ( $name )
        {
            case "name" :
            {
                return $this->Name;
            } break;

            case "multioption_list" :
            {
                return $this->Options;
            } break;
            default:
            {
                eZDebug::writeError( "Attribute '$name' does not exist", __METHOD__ );
                return null;
            }break;
        }
    }
80924
protected Attribute setAttributeFromRawValue(String name, AttributeValue value) throws AttributeException {
		return setAttributeFromRawValue(name, value.getType(), value.getValue());
	}
998577
public void renameNodesWithAttributeValue(String oldName, String newName, String attributeName, String attributeValue) {
		List<Node> nodes = getNodesFromTreeByName(oldName);
		Iterator i = nodes.iterator();
		while (i.hasNext()) {
			Node n = (Node) i.next();
			n.setName(newName);
		}
	}
1051385
def _set_attribute(self, attribute, name, value):
        """"""
        try:
            if attribute is None:
                attribute = self._attribute_file_open( name )
            else:
                attribute.seek(0)

            if isinstance(value, str):
                value = value.encode()
            attribute.write(value)
            attribute.flush()
        except Exception as ex:
            self._raise_friendly_access_error(ex, name)
        return attribute
17417
private function setValue($object, string $attributeName, $value)
    {
        try {
            $this->propertyAccessor->setValue($object, $attributeName, $value);
        } catch (NoSuchPropertyException $exception) {
            // Properties not found are ignored
        }
    }
1227601
private static boolean isValuelessAttribute(String attribName) {
    boolean valueless = VALUELESS_ATTRIB_NAMES.contains(
        Strings.toLowerCase(attribName));
    return valueless;
  }