src/Attributes.php
public function attributes() : string
    {
        $return = [];
        ksort($this->attributes);
        foreach ($this->attributes as $name => $value) {
            if (is_null($value) || $value === true) {
                if ($name == 'value') {
                    continue;
                }
                $return[] = $name;
            } else {
                if ($value === false) {
                    continue;
                }
                if ($name == 'name') {
                    $value = preg_replace("@^\[(.*?)\]@", '$1', $value);
                }
                $return[] = sprintf(
                    '%s="%s"',
                    $name,
                    htmlentities($value, ENT_COMPAT, 'UTF-8')
                );
            }
        }
        return $return ? ' '.implode(' ', $return) : '';
    }
public function attributes() : string
    {
        $return = [];
        ksort($this->attributes);
        foreach ($this->attributes as $name => $value) {
            if (is_null($value) || $value === true) {
                if ($name == 'value') {
                    continue;
                }
                $return[] = $name;
            } else {
                if ($value === false) {
                    continue;
                }
                if ($name == 'name') {
                    $value = preg_replace("@^\[(.*?)\]@", '$1', $value);
                }
                $return[] = sprintf(
                    '%s="%s"',
                    $name,
                    htmlentities($value, ENT_COMPAT, 'UTF-8')
                );
            }
        }
        return $return ? ' '.implode(' ', $return) : '';
    }
public function attributes ( ) : string { $ return = [ ] ; ksort ( $ this -> attributes ) ; foreach ( $ this -> attributes as $ name => $ value ) { if ( is_null ( $ value ) || $ value === true ) { if ( $ name == 'value' ) { continue ; } $ return [ ] = $ name ; } else { if ( $ value === false ) { continue ; } if ( $ name == 'name' ) { $ value = preg_replace ( "@^\[(.*?)\]@" , '$1' , $ value ) ; } $ return [ ] = sprintf ( '%s="%s"' , $ name , htmlentities ( $ value , ENT_COMPAT , 'UTF-8' ) ) ; } } return $ return ? ' ' . implode ( ' ' , $ return ) : '' ; }
Formats set attributes as a string ready for insertion into HTML.

@return string
Formats set attributes as a string ready for insertion into HTML .