src/Reform/Helper/Html.php
public static function addToAttribute($attribute, $addition)
    {
        $new = array_unique(array_merge(explode(' ', $attribute), explode(' ', $addition)));

        //strip out any empty strings from extra whitespace between values
        //e.g. class=" foo bar     baz "
        $new = array_filter($new, function($value) {
            return $value !== '';
        });

        return implode(' ', $new);
    }
public static function addToAttribute($attribute, $addition)
    {
        $new = array_unique(array_merge(explode(' ', $attribute), explode(' ', $addition)));

        //strip out any empty strings from extra whitespace between values
        //e.g. class=" foo bar     baz "
        $new = array_filter($new, function($value) {
            return $value !== '';
        });

        return implode(' ', $new);
    }
public static function addToAttribute ( $ attribute , $ addition ) { $ new = array_unique ( array_merge ( explode ( ' ' , $ attribute ) , explode ( ' ' , $ addition ) ) ) ; //strip out any empty strings from extra whitespace between values //e.g. class=" foo bar     baz " $ new = array_filter ( $ new , function ( $ value ) { return $ value !== '' ; } ) ; return implode ( ' ' , $ new ) ; }
Add to the value of an attribute, checking for duplicates. This
could be used to add css classes when css classes already
exist.

@param string $attribute The value of the attribute
@param string $addition  The text to add
Add to the value of an attribute checking for duplicates . This could be used to add css classes when css classes already exist .