public function attributesToString(array $attributes = []): string
    {
        $html = [];
        foreach ($attributes as $key => $value) {
            if (is_array($value)) {
                $value = json_encode($value);
            }

            if (in_array($key, $this->booleanAttributes, true)) {
                $value = $this->prepareBooleanAttribute($key, $value);
            }

            if ($value === '') {
                continue;
            }

            $html[] = sprintf(
                '%s="%s"',
                $this->escapeAttribute($key),
                $this->escapeAttribute($value)
            );
        }

        return implode(' ', $html);
    }
public function attributesToString(array $attributes = []): string
    {
        $html = [];
        foreach ($attributes as $key => $value) {
            if (is_array($value)) {
                $value = json_encode($value);
            }

            if (in_array($key, $this->booleanAttributes, true)) {
                $value = $this->prepareBooleanAttribute($key, $value);
            }

            if ($value === '') {
                continue;
            }

            $html[] = sprintf(
                '%s="%s"',
                $this->escapeAttribute($key),
                $this->escapeAttribute($value)
            );
        }

        return implode(' ', $html);
    }
public function attributesToString ( array $ attributes = [ ] ) : string { $ html = [ ] ; foreach ( $ attributes as $ key => $ value ) { if ( is_array ( $ value ) ) { $ value = json_encode ( $ value ) ; } if ( in_array ( $ key , $ this -> booleanAttributes , true ) ) { $ value = $ this -> prepareBooleanAttribute ( $ key , $ value ) ; } if ( $ value === '' ) { continue ; } $ html [ ] = sprintf ( '%s="%s"' , $ this -> escapeAttribute ( $ key ) , $ this -> escapeAttribute ( $ value ) ) ; } return implode ( ' ' , $ html ) ; }
Formatting a given array into a key="value"-string for each entry.

@param array $attributes

@return string $html
Formatting a given array into a key = value - string for each entry .