/*!
Returns an attribute. The valid attributes are \c name and \c multioption_list
\a name contains the name of multioption
\a multioption_list contains the list of all multioptions.
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;
        }
    }
821312
function getAttributeSet (attributes) {
  let attrs = {}
  Array.prototype.slice.apply(attributes).forEach(function (attr) {
    attrs[attr.name] = attr.value
  })
  return attrs
}
294916
public Object getAttribute(String name)
    throws IOException
  {
    if (! _didGet)
      getConnInput();
    
    return _attributes.get(name.toLowerCase(Locale.ENGLISH));
  }
421226
def [](name)
      attribute = @server.getAttribute(@object_name, name.to_s)
      return attribute.value if attribute.kind_of? javax.management.Attribute
      attribute
    end
834558
def get_attribute_option(self, attribute, option_name):
        
        self.__validate_attribute_option_name(option_name)
        attribute_key = self.__make_key(attribute)
        return self.__attribute_options[attribute_key].get(option_name)
1046978
public function attribute( $name )
    {
        if ( $this->hasAttribute( $name ) )
        {
            return $this->attributes[$name];
        }
        else
        {
            $value = null;
            return $value;
        }
    }
1318660
function get($name, $default=null) {
    $map = array_map(function($name) use($default){
      if ($this->__isset($name)) {
        return $this->__attributes[$name]['value'];
      } elseif ($this->propertyExists($name, 'default')) {
        return $this->__attributes[$name]['default'];
      }

      return (null === $default) ? null : $default;
    }, (array) $name);

    return count($map) > 1 ? $map : $map[0];
  }
128364
public function select(
		$name,
		$list = [],
		$selected = null,
		array $attributes = [],
		array $options_attributes = [],
		array $optgroups_attributes = []
	) {
		$this->type = 'select';

		// When building a select box the "value" attribute is really the selected one
		// so we will use that when checking the model or session for a value which
		// should provide a convenient method of re-populating the forms on post.
		$selected = $this->get_value_attribute( $name, $selected );

		$attributes['id'] = $this->get_id_attribute( $name, $attributes );

		if ( ! isset( $attributes['name'] ) ) {
			$attributes['name'] = $name;
		}

		// We will simply loop through the options and build an HTML value for each of
		// them until we have an array of HTML declarations. Then we will join them
		// all together into one single HTML element that can be put on the form.
		$html = [];

		if ( isset( $attributes['placeholder'] ) ) {
			$html[] = $this->placeholder_option( $attributes['placeholder'], $selected );
			unset( $attributes['placeholder'] );
		}

		foreach ( $list as $value => $display ) {
			$option_atts   = Arr::get( $options_attributes, $value, [] );
			$optgroup_atts = Arr::get( $optgroups_attributes, $value, [] );

			$html[] = $this->get_select_option( $display, $value, $selected, $option_atts, $optgroup_atts );
		}

		// Once we have all of this HTML, we can join this into a single element after
		// formatting the attributes into an HTML "attributes" string, then we will
		// build out a final select statement, which will contain all the values.
		$attributes = $this->attributes( $attributes, true );

		$list = implode( '', $html );

		return $this->to_html_string( "<select{$attributes}>{$list}</select>" );
	}
1119193
@Override
    public Object getAttributeValue(String name) {
        final List<Object> values = this.getAttributeValues(name);
        if (values != null && values.size() > 0) {
            return values.get(0);
        }

        return null;
    }
1218715
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
    {
        if ( $currentVersion == false )
        {
            $multioption = $contentObjectAttribute->content();
            if ( $multioption )
            {
                $contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
                $multioption->setName( $contentClassAttribute->attribute( 'data_text1' ) );
                $contentObjectAttribute->setAttribute( "data_text", $multioption->xmlString() );
                $contentObjectAttribute->setContent( $multioption );
            }
        }
        else
        {
            $dataText = $originalContentObjectAttribute->attribute( "data_text" );
            $contentObjectAttribute->setAttribute( "data_text", $dataText );
        }
    }
1082737
function validateAddToBasket( $objectAttribute, $data, &$errors )
    {

        $optiongroup = $objectAttribute->attribute( 'content' );
        $rules = $optiongroup->Rules;

        $validationErrors = array();


        foreach( $data as $moptionID => $selectedItem )
        {
            $failedOptionData = $optiongroup->findMultiOption( $moptionID );
            $failedMultiOption = $failedOptionData['group']->Options[$failedOptionData['id']];
            $failedOption = $optiongroup->findOption( $failedMultiOption, $selectedItem );
            if ( $failedOption['is_selectable'] != 1 )
            {
                $objectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
                                                              "You cannot choose option value \"%1\" from \"%2\" because it is unselectable " ),
                                                      $failedOption['value'],
                                                      $failedMultiOption['name'] );
                $validationErrors[] = $objectAttribute->attribute( 'validation_error' );
            }
            if ( ! isset( $rules[$selectedItem] ) )
                continue;

            $rulesForOption = $rules[$selectedItem];
            foreach( array_keys( $rulesForOption ) as $ruleKey )
            {

                if ( isset( $data[$ruleKey] ) )
                {
                    $selectedMultioptionValue = $data[$ruleKey];
                    $canSelectIfIdArray = $rulesForOption[$ruleKey];
                    if ( !in_array( $data[$ruleKey], $canSelectIfIdArray  ) )
                    {
                        $wrongParentData =  $optiongroup->findMultiOption( $ruleKey );
                        $wrongParentMultiOption = $wrongParentData['group']->Options[$wrongParentData['id']];

                        $wrongParentOptionID = $data[$ruleKey];
                        $wrongParentOption =  $optiongroup->findOption( $wrongParentMultiOption, $wrongParentOptionID );

                        $objectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
                                                                      "You cannot choose option value \"%1\" from \"%2\"  \n if you selected option \"%3\" from \"%4\" " ),
                                                              $failedOption['value'],
                                                              $failedMultiOption['name'],
                                                              $wrongParentOption['value'],
                                                              $wrongParentMultiOption['name'] );
                        $validationErrors[] = $objectAttribute->attribute( 'validation_error' );

                    }
                }
            }
        }

        if ( count( $validationErrors ) > 0 )
        {
            $errors = $validationErrors;
            return eZInputValidator::STATE_INVALID;
        }
        return eZInputValidator::STATE_ACCEPTED;
    }
300202
def check_for_list_option option_name
      return nil if @options[option_name].nil?

      return [@options[option_name]] if @options[option_name].is_a?(String) or @options[option_name].is_a(Hash)
      return @options[option_name] if @options[option_name].is_a?(Array)

      raise "Invalid data type provided for option #{option_name}: a list was expected. Please provide a single string element or an array of strings."
    end
69031
function attribute(element, name, val) {
  return supports.attributes || !supports.html
  ? element.getAttribute(name)
  : (val = element.getAttributeNode(name)) && val.specified ? val.value : '';
}
187111
function attribute( $attr )
    {
        switch ( $attr )
        {
            case 'currency_list':
            {
                return $this->currencyList();
            } break;

            case 'auto_currency_list':
            {
                return $this->autoCurrencyList();
            } break;

            case 'price_list':
            {
                return $this->priceList();
            } break;

            case 'inc_vat_price_list':
            {
                return $this->incVATPriceList();
            } break;

            case 'ex_vat_price_list':
            {
                return $this->exVATPriceList();
            } break;

            case 'discount_inc_vat_price_list':
            {
                return $this->discountIncVATPriceList();
            } break;

            case 'discount_ex_vat_price_list':
            {
                return $this->discountExVATPriceList();
            } break;

            case 'auto_price_list':
            {
                return $this->autoPriceList();
            } break;

            case 'custom_price_list':
            {
                return $this->customPriceList();
            } break;

            default :
            {
                return eZSimplePrice::attribute( $attr );
            } break;
        }
    }
1361487
public function attribute($name)
    {
        $v = $this->attributes()->$name;
        if(!empty($v))
            return (string)$v;
    }
1196392
function(options) {
      var attrs = options.attributes;
      if (_.isFunction(attrs)) {
        attrs = attrs();
      }
      if (_.isArray(attrs)) {
        return attrs;
      }
    }
361625
function getAttribute(node, attrName) {
	attrName = attrName.toLowerCase();
	return node && node.open.attributes.find(attr => attr.name.value.toLowerCase() === attrName);
}