Returns an attribute of the node.

@param string attr The attribute name.

@return string
436864
public function attr($attr) {
		if($this->domnode === null)
			return null;
		return $this->domnode->getAttribute($attr);
	}
852902
public function attr($attribute)
    {
        if (!$this->nodes) {
            throw new \InvalidArgumentException('The current node list is empty.');
        }

        $node = $this->getNode(0);

        return $node->hasAttribute($attribute) ? $node->getAttribute($attribute) : null;
    }
1163461
public function attr($attribute, $value = null)
    {
        if (is_array($attribute)) return $this->attributes($attribute);
        if ($value) return $this->attributes(array($attribute => $value));
    }
1122171
public function attr_first($attr)
    {
        return $this->_nodes ? current($this->_nodes)->getAttribute($attr) : null;
    }
1126090
public function getAttribute($attribute)
    {
        $ret = '';
        if (isset($this->attributeHash[$attribute])) {
            $ret = $this->attributeHash[$attribute];
        }

        return $ret;
    }
272639
public static String getNodeAttrText(Node node, String attrName) {
        Node fieldNode = node.selectSingleNode(attrName);
        return XmlNodeHelper.getNodeText(fieldNode);
    }
1349675
protected function _attr($attributes = [])
    {
        $attribute = '';

        if( is_array($attributes) )
        {
            foreach( $attributes as $key => $values )
            {
                if( is_numeric($key) )
                {
                    $key = $values;
                }

                $attribute .= ' '.$key.':'.$values.';';
            }
        }

        return $attribute;
    }
1063509
public function getAttr(string $name)
    {
        if (!isset($this->attr[$name]))
        {
            return NULL;
        }

        return $this->attr[$name];
    }
330002
static final String attr(Element element, String name, boolean ignoreNamespace) {
        NamedNodeMap attributes = element.getAttributes();

        for (int i = 0; i < attributes.getLength(); i++) {
            String localName = attributes.item(i).getNodeName();

            // [#103] If namespaces are ignored, consider only local
            // part of possibly namespace-unaware Element
            if (ignoreNamespace)
                localName = stripNamespace(localName);

            if (name.equals(localName))
                return attributes.item(i).getNodeValue();
        }

        return null;
    }
279406
function getAttribute($xml, $attribute)
    {
        if($xml instanceof SimpleXMLElement) {
	        $attributes = $xml->attributes();
	        if (isset($attributes[$attribute])) {
		        $xml = (string)$attributes[$attribute];
	        } else {
		        $xml = null;
	        }
        } else {
            $xml = null;
        }
        return $xml;
    }
1128688
public function attributeWas($attr)
    {
        return $this->attributeChanged($attr) ?
                $this->changedAttributes[$attr] :
                $this->getAttribute($attr);
    }
1055872
public function getAttribStr($name)
	{
		$value = $this->attributes[$name];
		if ($value === null || $value === false || $name === null) {
			return '';
		}
		if ($value === true) {
			if ($this->element) {
				$class = get_class($this->element);
				if ($class::HTML_MODE) {
					return ' ' . $name;
				}
			}
			$value = $name;
		}
		return ' ' . $name . '="' . $value . '"';
	}
1356288
private function attributesStr(array $attr)
    {
        $output = [];
        foreach ($attr as $name => $value) {
            $output[] = "{$name}=\"{$value}\"";
        }
        return implode(' ', $output);
    }
1055350
private function _getBelongsKey($attr)
    {
        $cls = get_called_class();

        if (!array_key_exists($cls, self::$_belongs_to)
            || !array_key_exists($attr, self::$_belongs_to[$cls])
        ) {
            return null;
        }
        $configs       = self::$_belongs_to[$cls][$attr];
        $belongs_cls   = is_array($configs) && array_key_exists("class_name",  $configs) ? $configs["class_name"]  : ucfirst($attr);
        $belongs_key   = is_array($configs) && array_key_exists("foreign_key", $configs) ? $configs["foreign_key"] : strtolower($belongs_cls)."_id";
        return $belongs_key;
    }
518663
function attribute( $attr )
    {
        if ( isset( $this->Attributes[$attr] ) )
        {
            return $this->$attr();
        }
        else if ( $attr == 'wwwdir' )
        {
            return $this->wwwDir();
        }
        else if ( $attr == 'sitedir' )
        {
            return $this->siteDir();
        }
        else if ( $attr == 'indexfile' )
        {
            return $this->indexFile();
        }
        else if ( $attr == 'indexdir' )
        {
            return $this->indexDir();
        }
        else if ( $attr = 'querystring' )
        {
            return $this->queryString();
        }

        eZDebug::writeError( "Attribute '$attr' does not exist", __METHOD__ );
        return null;
    }
885435
public function attribute( $attr )
    {
        switch ( $attr )
        {
            case 'element':
                return $this->element();
                break;
            case 'tail':
                return $this->elements();
                break;
            case 'base':
                return $this->base();
                break;
            case 'index':
                return $this->index();
                break;
            case 'uri':
                return $this->uriString();
                break;
            case 'original_uri':
                return $this->originalURIString();
                break;
            case 'query_string':
                return eZSys::queryString();
                break;
            default:
            {
                eZDebug::writeError( "Attribute '$attr' does not exist", __METHOD__ );
                return null;
            } break;
        }
    }
1198273
public function getAttribute($attribute)
    {
        switch ($attribute) {
            case self::ATTR_PERSISTENT:
                return false;

            case self::ATTR_PREFETCH:
                return false;

            case self::ATTR_CLIENT_VERSION:
                return self::VERSION;

            case self::ATTR_SERVER_VERSION:
                return $this->server->getServerVersion();

            case self::ATTR_SERVER_INFO:
                return $this->server->getServerInfo();

            case self::ATTR_TIMEOUT:
                return $this->attributes['timeout'];

            case self::CRATE_ATTR_HTTP_BASIC_AUTH:
                return $this->attributes['auth'];

            case self::ATTR_DEFAULT_FETCH_MODE:
                return $this->attributes['defaultFetchMode'];

            case self::ATTR_ERRMODE:
                return $this->attributes['errorMode'];

            case self::ATTR_DRIVER_NAME:
                return static::DRIVER_NAME;

            case self::ATTR_STATEMENT_CLASS:
                return [$this->attributes['statementClass']];

            case self::CRATE_ATTR_DEFAULT_SCHEMA:
                return $this->attributes['defaultSchema'];

            case self::CRATE_ATTR_SSL_MODE:
                return $this->attributes['sslMode'];

            case self::CRATE_ATTR_SSL_CA_PATH:
                return $this->attributes['sslCa'] ?? null;

            case self::CRATE_ATTR_SSL_CA_PASSWORD:
                return $this->attributes['sslCaPassword'] ?? null;

            case self::CRATE_ATTR_SSL_CERT_PATH:
                return $this->attributes['sslCert'] ?? null;

            case self::CRATE_ATTR_SSL_CERT_PASSWORD:
                return $this->attributes['sslCertPassword'] ?? null;

            case self::CRATE_ATTR_SSL_KEY_PATH:
                return $this->attributes['sslKey'] ?? null;

            case self::CRATE_ATTR_SSL_KEY_PASSWORD:
                return $this->attributes['sslKeyPassword'] ?? null;

            default:
                // PHP Switch is a lose comparison
                if ($attribute === self::ATTR_AUTOCOMMIT) {
                    return true;
                }

                throw new Exception\PDOException(sprintf('Unsupported driver attribute: %s', $attribute));
        }
    }