src/Util/Text.php
protected static function _arrayToString($data, $options)
    {
        if (empty($data)) {
            return '[]';
        }

        extract($options['array']);
        /**
         * @var string $char
         * @var int $indent
         * @var int $multiplier
         */
        $comma = false;

        $tab = str_repeat($char, $indent * $multiplier);

        $string = "[\n";

        foreach ($data as $key => $value) {
            if ($comma) {
                $string .= ",\n";
            }
            $comma = true;
            $key = filter_var($key, FILTER_VALIDATE_INT) ? $key : static::dump($key, $options['quote']);
            $string .= $tab . $key . ' => ';
            if (is_array($value)) {
                $options['array']['indent'] = $indent + 1;
                $string .= static::_arrayToString($value, $options);
            } else {
                $string .= static::toString($value, $options);
            }
        }
        $tab = str_repeat($char, ($indent - 1) * $multiplier);
        return $string . "\n" . $tab . "]";
    }
protected static function _arrayToString($data, $options)
    {
        if (empty($data)) {
            return '[]';
        }

        extract($options['array']);
        /**
         * @var string $char
         * @var int $indent
         * @var int $multiplier
         */
        $comma = false;

        $tab = str_repeat($char, $indent * $multiplier);

        $string = "[\n";

        foreach ($data as $key => $value) {
            if ($comma) {
                $string .= ",\n";
            }
            $comma = true;
            $key = filter_var($key, FILTER_VALIDATE_INT) ? $key : static::dump($key, $options['quote']);
            $string .= $tab . $key . ' => ';
            if (is_array($value)) {
                $options['array']['indent'] = $indent + 1;
                $string .= static::_arrayToString($value, $options);
            } else {
                $string .= static::toString($value, $options);
            }
        }
        $tab = str_repeat($char, ($indent - 1) * $multiplier);
        return $string . "\n" . $tab . "]";
    }
protected static function _arrayToString ( $ data , $ options ) { if ( empty ( $ data ) ) { return '[]' ; } extract ( $ options [ 'array' ] ) ; /**
         * @var string $char
         * @var int $indent
         * @var int $multiplier
         */ $ comma = false ; $ tab = str_repeat ( $ char , $ indent * $ multiplier ) ; $ string = "[\n" ; foreach ( $ data as $ key => $ value ) { if ( $ comma ) { $ string .= ",\n" ; } $ comma = true ; $ key = filter_var ( $ key , FILTER_VALIDATE_INT ) ? $ key : static :: dump ( $ key , $ options [ 'quote' ] ) ; $ string .= $ tab . $ key . ' => ' ; if ( is_array ( $ value ) ) { $ options [ 'array' ] [ 'indent' ] = $ indent + 1 ; $ string .= static :: _arrayToString ( $ value , $ options ) ; } else { $ string .= static :: toString ( $ value , $ options ) ; } } $ tab = str_repeat ( $ char , ( $ indent - 1 ) * $ multiplier ) ; return $ string . "\n" . $ tab . "]" ; }
Generate a string representation of an array.

@param  array  $data An array.
@param  array  $options An array of options.

@return string          The dumped string.
Generate a string representation of an array .