{@inheritdoc}

@see \Concrete\Core\Attribute\SimpleTextExportableAttributeInterface::getAttributeValueTextRepresentation()
498728
public function getAttributeValueTextRepresentation()
    {
        $result = '';
        $value = $this->getAttributeValueObject();
        if ($value !== null) {
            $topics = $value->getSelectedTopics();
            if (!empty($topics)) {
                $ids = [];
                foreach ($topics as $topic) {
                    /* @var \\Concrete\Core\Entity\Attribute\Value\Value\SelectedTopic $topic */
                    $ids[] = 'tid:' . $topic->getTreeNodeID();
                }
                $result = implode('|', $ids);
            }
        }

        return $result;
    }
965998
public function updateAttributeValueFromTextRepresentation(array $textRepresentation, ErrorList $warnings)
    {
        $textRepresentation = array_map('trim', $textRepresentation);
        $value = $this->getAttributeValueObject();
        if ($value === null) {
            if (implode('', $textRepresentation) !== '') {
                $value = new AddressValue();
            }
        }
        if ($value !== null) {
            /* @var AddressValue $value */
            $value->setAddress1(trim(array_shift($textRepresentation)));
            $value->setAddress2(trim(array_shift($textRepresentation)));
            $value->setAddress3(trim(array_shift($textRepresentation)));
            $value->setCity(trim(array_shift($textRepresentation)));
            $value->setStateProvince(trim(array_shift($textRepresentation)));
            $value->setCountry(trim(array_shift($textRepresentation)));
            $value->setPostalCode(trim(array_shift($textRepresentation)));

            $countryCode = (string) $value->getCountry();
            if ($countryCode !== '') {
                $cl = $this->app->make(CountryList::class);
                /* @var CountryList $cl */
                $countries = $cl->getCountries();
                if (!isset($countries[$countryCode])) {
                    $warnings->add(t('"%1$s" is not a valid Country code for the attribute with handle %2$s', $countryCode, $this->attributeKey->getAttributeKeyHandle()));
                } else {
                    $countryName = $countries[$countryCode];
                    $stateProvinceCode = $value->getStateProvince();
                    if ($stateProvinceCode !== '') {
                        $spl = $this->app->make(StatesProvincesList::class);
                        /* @var StatesProvincesList $spl */
                        $statesProvinces = $spl->getStateProvinceArray($countryCode);
                        if ($statesProvinces !== null && !isset($statesProvinces[$stateProvinceCode])) {
                            $warnings->add(t('"%1$s" is not a valid State/Province code for the Country %2$s (attribute with handle %3$s)', $stateProvinceCode, $countryName, $this->attributeKey->getAttributeKeyHandle()));
                        }
                    }
                }
            }
        }

        return $value;
    }
74720
public static function prepare_attr_value ($text) {
		if (is_array($text)) {
			/** @noinspection ForeachSourceInspection */
			foreach ($text as &$t) {
				$t = static::prepare_attr_value($t);
			}
			return $text;
		}
		return strtr(
			$text,
			[
				'&'  => '&amp;',
				'"'  => '&quot;',
				'\'' => '&apos;',
				'<'  => '&lt;',
				'>'  => '&gt;'
			]
		);
	}
579997
public function prepareAttributeValue($mapping, $value)
    {
        if ($value === null) {
            return Type::getNull();
        }

        $type = $mapping !== null ? $mapping->getType() : TypeFactory::getTypeFromPHPVariable($value);

        if (is_array($value)) {
            $value = array_map(
                function ($v) {
                    $this->prepareAttributeValue(null, $v);
                },
                $value
            );
        }

        return $type->convertToDatabaseValue($value);
    }
17203
protected function getSanitizedValue($value)
    {
        $validation_result = $this->getValidator()->validate($value);

        if ($validation_result->getSeverity() > IncidentInterface::NOTICE) {
            throw new BadValueException(
                sprintf(
                    "Given value for attribute '%s' on entity type '%s' is not valid.",
                    $this->getName(),
                    $this->getType() ? $this->getType()->getName() : 'undefined'
                )
            );
        }

        return $validation_result->getSanitizedValue();
    }
306535
public function getDisplayValue()
    {
        $result = '';
        $datetime = $this->getDateTime();
        if ($datetime !== null) {
            if ($this->akDateDisplayMode === null) {
                $this->load();
            }
            $dh = $this->app->make('helper/date');
            /* @var \Concrete\Core\Localization\Service\Date $dh */
            switch ($this->akDateDisplayMode) {
                case 'date':
                    $result = $dh->formatDate($datetime, 'short', $datetime->getTimezone());
                    break;
                case 'date_text':
                    if ($this->akTextCustomFormat === '') {
                        $result = $dh->formatDate($datetime, 'short', $datetime->getTimezone());
                    } else {
                        $result = $dh->formatCustom($this->akTextCustomFormat, $datetime, $datetime->getTimezone());
                    }
                    break;
                case 'text':
                    if ($this->akTextCustomFormat === '') {
                        $result = $dh->formatDateTime($datetime);
                    } else {
                        $result = $dh->formatCustom($this->akTextCustomFormat, $datetime);
                    }
                    break;
                case 'date_time':
                default:
                    $result = $dh->formatDateTime($datetime);
                    break;
            }
        }

        return $result;
    }
228897
protected function getDisplayValue() : string
    {
        try {
            $displayField = $this->table->getDisplayField();
            $displayValue = $this->entity->get($displayField);

            $factory = new FieldHandlerFactory();
            $result = $factory->renderValue($this->table, $displayField, $displayValue, [ 'renderAs' => 'plain']);
        } catch (InvalidArgumentException $e) {
            $result = 'reminder';
        }

        return $result;
    }
482730
protected function getAttributeContext(
        DataInterface $object,
        $attribute,
        /** @noinspection PhpUnusedParameterInspection */
        $rawValue,
        array $context
    ) {
        return array_merge(
            $context,
            [
                'parent' => $object,
                'attribute' => $attribute,
            ]
        );
    }
256424
public function getSetterDeclarationLine(CPPAttribute $attribute)
    {
        if ('object' === $attribute->getType()) {
            return $this->getEntity()->getProject()->getAutocodeProperty('base')
                ? $this->getEntity()->getNameBase() . ' ' . $this->getEntity()->getNameBase() . '::' . $attribute->getSetterName() . '(' . $attribute->getEntitySubtype()->getName() . ' _' . $attribute->getName() . ')'
                : $this->getEntity()->getName() . ' ' . $this->getEntity()->getName() . '::' . $attribute->getSetterName() . '(' . $attribute->getEntitySubtype()->getName() . ' _' . $attribute->getName() . ')';
        } else {
            return $this->getEntity()->getProject()->getAutocodeProperty('base')
                ? $this->getEntity()->getNameBase() . ' ' . $this->getEntity()->getNameBase() . '::' . $attribute->getSetterName() . '(' . $attribute->getType() . ' _' . $attribute->getName() . ')'
                : $this->getEntity()->getName() . ' ' . $this->getEntity()->getName() . '::' . $attribute->getSetterName() . '(' . $attribute->getType() . ' _' . $attribute->getName() . ')';
        }
    }
396832
protected function attributeValue() {
        if ($this->scanner->current() != '=') {
            return null;
        }
        $this->scanner->next();
        // 8.1.2.3
        $this->scanner->whitespace();

        $tok = $this->scanner->current();
        switch ($tok) {
            case "\n":
            case "\f":
            case " ":
            case "\t":
                // Whitespace here indicates an empty value.
                return null;
            case '"':
            case "'":
                $this->scanner->next();
                return $this->quotedAttributeValue($tok);
            case '>':
                // case '/': // 8.2.4.37 seems to allow foo=/ as a valid attr.
                $this->parseError("Expected attribute value, got tag end.");
                return null;
            case '=':
            case '`':
                $this->parseError("Expecting quotes, got %s.", $tok);
                return $this->unquotedAttributeValue();
            default:
                return $this->unquotedAttributeValue();
        }
    }
1227703
public function getAttribute($key)
    {
        $value = parent::getAttribute($key);

        if ($key === 'name') {
            $value = str_replace($this->multiValueSuffix, '', $value);
        }

        return $value;
    }
621866
protected function getDiscountPriceValueAttribute()
    {
        $fOldPrice = $this->old_price_value;
        $fPrice = $this->price_value;

        $fDiscountPrice = 0;
        if ($fOldPrice > 0) {
            $fDiscountPrice = PriceHelper::round($fOldPrice - $fPrice);
        }

        $fPrice = CurrencyHelper::instance()->convert($fDiscountPrice, $this->getActiveCurrency());

        return $fPrice;
    }
1237038
@Override
    public String getValue() {
        String value = attrMixin.getAttribute(VALUE);
        return value.isEmpty() ? getText() : value;
    }
199102
protected function formatAttributeValue(Attribute $attribute)
    {
        $value = $attribute->getValue();
        
        if ($attribute->getType() === Attribute::TYPE_FUNCTION && strlen($value)) {
            return new Expr($value);
        }
        
        return $value;
    }
412070
public function getAttributeValue($key)
    {
        if (! $this->isTranslatableAttribute($key)) {
            return parent::getAttributeValue($key);
        }

        return $this->getTranslation($key, config('app.locale')) ?: array_first($this->getTranslations($key));
    }
450166
public function getValue028Attribute($value)
    {
        if($this->data_type_type_028 == 'array')
            $value = explode(',', $value);
        else
            settype($value, $this->data_type_type_028);

        return $value;
    }
895915
public function __toAttribute()
	{
		if ( $this->count() ) {
			$attr = null;

			if ( is_string( $this->attribute ) ) {
				$attr = $this->attribute;
			}
			elseif ( $this->attribute instanceof DOMAttr ) {
				$attr = $this->attribute->name;
			}

			if ( $attr ) {
				$values = htmlspecialchars((string) $this, ENT_QUOTES, ini_get('default_charset'), false);
				return sprintf('%1$s="%2$s"', $attr, $values);
			}
		}

		return '';
	}