src/MarkupAssertionsTrait.php
protected function flattenAttributeArray(array $attributes)
    {
        if (empty($attributes)) {
            throw new RiskyTestError('Attributes array is empty.');
        }

        array_walk($attributes, function (&$value, $key) {
            // Boolean attributes.
            if (null === $value) {
                $value = sprintf('[%s]', $key);
            } else {
                $value = sprintf('[%s="%s"]', $key, htmlspecialchars($value));
            }
        });

        return implode('', $attributes);
    }
protected function flattenAttributeArray(array $attributes)
    {
        if (empty($attributes)) {
            throw new RiskyTestError('Attributes array is empty.');
        }

        array_walk($attributes, function (&$value, $key) {
            // Boolean attributes.
            if (null === $value) {
                $value = sprintf('[%s]', $key);
            } else {
                $value = sprintf('[%s="%s"]', $key, htmlspecialchars($value));
            }
        });

        return implode('', $attributes);
    }
protected function flattenAttributeArray ( array $ attributes ) { if ( empty ( $ attributes ) ) { throw new RiskyTestError ( 'Attributes array is empty.' ) ; } array_walk ( $ attributes , function ( & $ value , $ key ) { // Boolean attributes. if ( null === $ value ) { $ value = sprintf ( '[%s]' , $ key ) ; } else { $ value = sprintf ( '[%s="%s"]' , $ key , htmlspecialchars ( $ value ) ) ; } } ) ; return implode ( '' , $ attributes ) ; }
Given an array of HTML attributes, flatten them into a XPath attribute selector.

@since 1.0.0

@throws RiskyTestError When the $attributes array is empty.

@param array $attributes HTML attributes and their values.

@return string A XPath attribute query selector.
Given an array of HTML attributes flatten them into a XPath attribute selector .