Return an attribute object, used for building an expression.

@see QueryBuilder::attr()

@param string      $name Top-level attribute name.
@param string|null $discriminatorValue

@return Operand\Attribute|Operand\RootAttribute
346620
public function attr($name, $discriminatorValue = null)
    {
        if (empty($name)) {
            throw new \InvalidArgumentException;
        }

        return new Operand\Attribute($this, $name, $discriminatorValue);
    }
27285
function attribute( $name )
    {
        switch ( $name )
        {
            case 'output_text':
            {
                return $this->outputText();
            } break;
            case 'aliased_type':
            {
                return $this->AliasedType;
            } break;
            case 'view_template_name':
            {
                return $this->viewTemplateName();
            } break;
            case 'aliased_handler':
            {
                if ( $this->AliasedHandler === null )
                {
                    $this->AliasedHandler = eZXMLText::inputHandler( $this->XMLData,
                                                                      $this->AliasedType,
                                                                      false,
                                                                      $this->ContentObjectAttribute );
                }
                return $this->AliasedHandler;
            } break;
            default:
            {
                eZDebug::writeError( "Attribute '$name' does not exist", __METHOD__ );
                return null;
            } break;
        }
    }
448304
public function getAttribute($name)
    {
        assert('is_string($name)');

        $value = null;
        if (isset($this->_attributes[$name])) {
            return $this->_attributes[$name];
        }
        return $value;
    }
391469
public function getValueAttribute($name, $value = null)
    {
        if (is_null($name)) {
            return $value;
        }

        if (!str_contains($name, ['[', ']']) && !is_null($this->old($name))) {
            return $this->old($name);
        }


        if (!is_null($value)) {
            return $value;
        }

        if (isset($this->model)) {
            return $this->getModelValueAttribute($name);
        }
    }
1259599
public function getRecurseAttribute($name)
    {
        $value = $this->getAttribute($name);
        $parent = $this->parent;
        if($value === null && $parent)
        {
            $value = $parent->getRecurseAttribute($name);
            $this->setAttribute($name, $value);
            return $value;
        }

        return $value;
    }
256101
public function getAttribute($name)
    {
        $value = parent::getAttribute($name);
        return (is_array($value)) ? $value[0] : $value;
    }
871587
public function createNode($discriminator = 'default')
    {
        $reflection = new \ReflectionClass($this->getClassByDiscriminator($discriminator));

        $instance = $reflection->newInstance();
        if($instance instanceof NodeInterface)
        {
            return $instance;
        }

        return null;
    }
1257927
protected function convertAttributeValueTemplate($attrValue)
	{
		$phpExpressions = [];
		foreach (AVTHelper::parse($attrValue) as $token)
		{
			if ($token[0] === 'literal')
			{
				$phpExpressions[] = var_export($token[1], true);
			}
			else
			{
				$phpExpressions[] = $this->convertXPath($token[1]);
			}
		}

		return implode('.', $phpExpressions);
	}
396498
public function getAttrib($name)
	{
		return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
	}
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;
        }
    }
925566
public function firstOf(string $name): Attribute
    {
        $attr = $this->_findFirst($name);
        if (!$attr) {
            throw new \UnexpectedValueException("No $name attribute.");
        }
        return $attr;
    }
912133
public function getAttribute($name, $default = null){
        if(!is_string($name)){
            throw new \InvalidArgumentException(
                "First argument must be of the type string, " . gettype($name) . " given."
            );
        }

        return array_key_exists($name, $this->attributes)
            ? $this->attributes[$name]
            : $default
        ;
    }
758490
public static function get($name, $defaultValue = null)
    {
        $model = self::find()->where([self::getNameAttribute() => $name])->asArray()->one();
    
        if ($model) {
            return $model[self::getValueAttribute()];
        }
    
        return $defaultValue;
    }
334180
public function getAttribute($attributes, $name) {
        foreach($attributes as $a) {
            if ($a->key == $name) {
                return $a->value;
            }
        }
        return null;
    }
702828
public function getAttribute($name, $default = null)
    {
        if ($this->hasAttribute($name)) {
            return $this->node->getAttribute($name);
        }

        return $default;
    }
134463
public function attr(string $name, $value = null) {
        if (is_null($value)) {
            return $this->getAttr($name);
        } else {
            return $this->setAttr($name, $value);
        }
    }
1172594
protected function _getAttributeValue($name)
    {
        if (!array_key_exists($name, $this->attributes)) {
            throw (new UnknownAttributeException("Programmer: Don't know how to retreive attribute `$name`."))
                ->addOffender($name);
        }

        if (!$this->getId()) {
            return $this->attributes[$name];
        }

        $this->initialize();

        return $this->attributes[$name];
    }