@param $dataValue
@param array $attributes

@return string
174801
private function getTd($dataValue, $attributes = [])
    {
        $attr = [];
        foreach ($attributes as $name => $value) {
            if ($value != '') {
                $attr[] = $name.'="'.$value.'"';
            }
        }

        $attr = implode(' ', $attr);

        return '<td '.$attr.'>'.$dataValue.'</td>';
    }
536914
public function createValue(DataInterface $data, AttributeInterface $attribute, array $context = null)
    {
        $valueClass = $this->getValueClass();
        /** @var ValueInterface $value */
        $value = new $valueClass($data, $attribute);
        $data->addValue($value);

        if ($value instanceof ContextualValueInterface
            && $data instanceof ContextualDataInterface
            && \count($attribute->getContextMask())
        ) {
            if ($context) {
                $context = array_merge($data->getCurrentContext(), $context);
            } else {
                $context = $data->getCurrentContext();
            }
            foreach ($attribute->getContextMask() as $key) {
                $value->setContextValue($key, $context[$key]);
            }
        }

        return $value;
    }
1296875
protected function getEAVAttributeValue(
        DataInterface $object,
        AttributeInterface $attribute,
        $format = null,
        array $context = []
    ) {
        $rawValue = $object->get($attribute->getCode());
        $subContext = $this->getEAVAttributeContext($object, $attribute, $rawValue, $context);

        return $this->normalizer->normalize($rawValue, $format, $subContext);
    }
292290
public function onFieldDataSave($currentValue, array $fieldData)
    {
        if (is_array($currentValue)) {
            return implode(parent::FIELD_SEP, $currentValue);
        }

        return $currentValue;
    }
495107
public function getValuesFor($attributes)
	{
		$ret = array();
		foreach ($attributes as $name) {
			if (array_key_exists($name, $this->_attributes)) {
				$ret[$name] = $this->_attributes[$name];
			}
		}
		return $ret;
	}
1276692
protected function getTypedValue ($rawValue) {
		if (gettype($rawValue) == "array") {
			foreach ($rawValue as $key => $value) {
				$rawValue[$key] = $this->getTypedValue($value);
			}
			return $rawValue; // array
		} else if (mb_strlen($rawValue) > 0) {
			if (is_numeric($rawValue)) {
				return $this->getTypedValueFloatOrInt($rawValue);
			} else {
				return $this->getTypedSpecialValueOrString($rawValue);
			}
		} else {
			return $this->getTypedSpecialValueOrString($rawValue);
		}
	}
311218
protected function skipNullValue(array $attributes)
    {
        $attr = [];

        foreach ($attributes as $key => $value) {
            if (null !== $value) {
                $attr[$key] = \is_array($value)
                    ? $this->skipNullValue($value)
                    : $value;
            }
        }

        return $attr;
    }
467217
public static function filter($attrValue)
	{
		if (preg_match('/^(?=\\d)(?:(\\d+)h)?(?:(\\d+)m)?(?:(\\d+)s)?$/D', $attrValue, $m))
		{
			$m += [0, 0, 0, 0];

			return intval($m[1]) * 3600 + intval($m[2]) * 60 + intval($m[3]);
		}

		return NumericFilter::filterUint($attrValue);
	}
858783
public function validate( string $attributeName, $attributeValue ) : ValidationResult
   {

      $result = new ValidationResult();

      if ( false === $this->has( $attributeName ) )
      {
         // Unknown argument name
         return $result
            ->setErrorMessage( 'Unknown Driver attribute name "' . $attributeName . '"!' );
      }

      if ( $this->_attributes[ $attributeName ]->validateValue( $attributeValue ) )
      {
         // The value is valid we are done here
         return $result
            ->setIsKnown( true )
            ->setIsValidValue( true )
            ->setValue( $attributeValue );
      }

      if ( $this->_attributes[ $attributeName ]->hasDefaultValue() )
      {
         // The defined value is not valid, but a default value is defined, that is used now
         return $result
            ->setIsKnown( true )
            ->setValue( $this->_attributes[ $attributeName ]->getDefaultValue() );
      }

      return $result
         ->setIsKnown( true )
         ->setErrorMessage( 'Unknown Driver argument "' . $attributeName . '" value "' . $attributeValue . '"!' );

   }
372355
protected function setInternalValuesData(AttributeInterface $attribute, $dataValues, array $context = null)
    {
        $this->checkAttribute($attribute);
        $dataValues = $this->ensureNativeArray($dataValues, $this->getFamilyCode().'.'.$attribute->getCode());
        $values = new ArrayCollection();
        $position = 0; // Reset position to zero

        foreach ($this->getInternalValues($attribute, $context) as $value) {
            // If there values to replace
            if (\count($dataValues)) {
                // Extract new values and replaces them one by one
                $dataValue = array_shift($dataValues);
                $value->setPosition(++$position);
                $this->setInternalValueData($attribute, $value, $dataValue);
                $values->add($value);
            } else {
                // If there are too much existing values previously, remove the extra ones
                $this->removeValue($value);
            }
        }

        // If there are still values to add
        foreach ($dataValues as $dataValue) {
            $value = $this->createValue($attribute, $context);
            $value->setPosition(++$position);
            $this->setInternalValueData($attribute, $value, $dataValue);
            $values->add($value);
        }

        return $values;
    }
153865
public function getMetadataAttr(string $attr, $defaultValue = null, array $options = [])
    {
        return $this->getMetadata()->get($attr, $defaultValue, $options);
    }
288982
public function getAttribute( string $name, $defaultValue = false )
   {

      if ( ! $this->hasAttribute( $name ) )
      {
         return $defaultValue;
      }

      return $this->_attributes[ $name ];

   }
210551
protected function parseDataAttribute(string $dataAttribute) : Generator
    {
        $matches = [];
        preg_match_all('/([a-zA-Z]+)([^|]*)/', $dataAttribute, $matches, PREG_SET_ORDER);

        foreach ($matches as $match) {
            $name    = $match[1];
            $options = [];

            if (isset($match[2])) {
                $allOptions = explode(',', $match[2]);
                foreach ($allOptions as $option) {
                    $option = explode(':', $option);
                    if (! isset($option[0], $option[1])) {
                        continue;
                    }

                    $options[trim($option[0], ' {}\'\"')] = trim($option[1], ' {}\'\"');
                }
            }

            yield $name => $options;
        }
    }
688285
public function removeAttributeValueTranslation(AttributeValue $attributeValue, $locale)
    {
        // Check if translation already exists for given locale.
        $attributeValueTranslation = $this->retrieveAttributeValueTranslationByLocale($attributeValue, $locale);
        if ($attributeValueTranslation) {
            $attributeValue->removeTranslation($attributeValueTranslation);
            $this->entityManager->remove($attributeValueTranslation);
        }
    }
566502
function _parseAttributes($attributes)
    {
        if (is_array($attributes)) {
            $ret = array();
            foreach ($attributes as $key => $value) {
                if (is_int($key)) {
                    $key = $value = strtolower($value);
                } else {
                    $key = strtolower($key);
                }
                $ret[$key] = $value;
            }
            return $ret;

        } elseif (is_string($attributes)) {
            $preg = "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" .
                "([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/";
            if (preg_match_all($preg, $attributes, $regs)) {
                for ($counter=0; $counter<count($regs[1]); $counter++) {
                    $name  = $regs[1][$counter];
                    $check = $regs[0][$counter];
                    $value = $regs[7][$counter];
                    if (trim($name) == trim($check)) {
                        $arrAttr[strtolower(trim($name))] = strtolower(trim($name));
                    } else {
                        if (substr($value, 0, 1) == "\"" || substr($value, 0, 1) == "'") {
                            $value = substr($value, 1, -1);
                        }
                        $arrAttr[strtolower(trim($name))] = trim($value);
                    }
                }
                return $arrAttr;
            }
        }
    }
482730
protected function getAttributeContext(
        DataInterface $object,
        $attribute,
        /** @noinspection PhpUnusedParameterInspection */
        $rawValue,
        array $context
    ) {
        return array_merge(
            $context,
            [
                'parent' => $object,
                'attribute' => $attribute,
            ]
        );
    }
135219
function setAttribute( $attributeName, $attributeValue )
    {
        if ( !in_array( $attributeName,
                        array( 'development',
                               'name', 'summary', 'description',
                               'vendor', 'vendor-dir', 'priority', 'type',
                               'install_type',
                               'extension', 'source',
                               'licence', 'state' ) ) )
            return false;
        if ( array_key_exists( $attributeName, $this->Parameters ) and
             !is_array( $this->Parameters[$attributeName] ))
        {
            $this->Parameters[$attributeName] = $attributeValue;
            return true;
        }
        return false;
    }