private static function buildAttribArrayVal($key, $value = array())
    {
        if ($key == 'class') {
            if (!\is_array($value)) {
                $value = \explode(' ', $value);
            }
            $value = \array_filter(\array_unique($value));
            \sort($value);
            $value = \implode(' ', $value);
        } elseif ($key == 'style') {
            $keyValues = array();
            foreach ($value as $k => $v) {
                $keyValues[] = $k.':'.$v.';';
            }
            \sort($keyValues);
            $value = \implode('', $keyValues);
        } else {
            $value = null;
        }
        return $value;
    }
private static function buildAttribArrayVal($key, $value = array())
    {
        if ($key == 'class') {
            if (!\is_array($value)) {
                $value = \explode(' ', $value);
            }
            $value = \array_filter(\array_unique($value));
            \sort($value);
            $value = \implode(' ', $value);
        } elseif ($key == 'style') {
            $keyValues = array();
            foreach ($value as $k => $v) {
                $keyValues[] = $k.':'.$v.';';
            }
            \sort($keyValues);
            $value = \implode('', $keyValues);
        } else {
            $value = null;
        }
        return $value;
    }
private static function buildAttribArrayVal ( $ key , $ value = array ( ) ) { if ( $ key == 'class' ) { if ( ! \ is_array ( $ value ) ) { $ value = \ explode ( ' ' , $ value ) ; } $ value = \ array_filter ( \ array_unique ( $ value ) ) ; \ sort ( $ value ) ; $ value = \ implode ( ' ' , $ value ) ; } elseif ( $ key == 'style' ) { $ keyValues = array ( ) ; foreach ( $ value as $ k => $ v ) { $ keyValues [ ] = $ k . ':' . $ v . ';' ; } \ sort ( $ keyValues ) ; $ value = \ implode ( '' , $ keyValues ) ; } else { $ value = null ; } return $ value ; }
Convert array attribute value to string

Convert class/style array value to string
This function is not meant for data attributs

@param string $key   attribute name (class|style)
@param array  $value classnames for class, key/value for style

@return string
Convert array attribute value to string