src/Util/Text.php
public static function toString($value, $options = [])
    {
        $defaults = [
            'quote'  => '"',
            'object' => [
                'method' => '__toString'
            ],
            'array'  => [
                'indent'     => 1,
                'char'       => ' ',
                'multiplier' => 4
            ]
        ];

        $options += $defaults;

        $options['array'] += $defaults['array'];
        $options['object'] += $defaults['object'];

        if ($value instanceof Closure) {
            return '`Closure`';
        }
        if (is_array($value)) {
            return static::_arrayToString($value, $options);
        }
        if (is_object($value)) {
            return static::_objectToString($value, $options);
        }
        return static::dump($value, $options['quote']);
    }
public static function toString($value, $options = [])
    {
        $defaults = [
            'quote'  => '"',
            'object' => [
                'method' => '__toString'
            ],
            'array'  => [
                'indent'     => 1,
                'char'       => ' ',
                'multiplier' => 4
            ]
        ];

        $options += $defaults;

        $options['array'] += $defaults['array'];
        $options['object'] += $defaults['object'];

        if ($value instanceof Closure) {
            return '`Closure`';
        }
        if (is_array($value)) {
            return static::_arrayToString($value, $options);
        }
        if (is_object($value)) {
            return static::_objectToString($value, $options);
        }
        return static::dump($value, $options['quote']);
    }
public static function toString ( $ value , $ options = [ ] ) { $ defaults = [ 'quote' => '"' , 'object' => [ 'method' => '__toString' ] , 'array' => [ 'indent' => 1 , 'char' => ' ' , 'multiplier' => 4 ] ] ; $ options += $ defaults ; $ options [ 'array' ] += $ defaults [ 'array' ] ; $ options [ 'object' ] += $ defaults [ 'object' ] ; if ( $ value instanceof Closure ) { return '`Closure`' ; } if ( is_array ( $ value ) ) { return static :: _arrayToString ( $ value , $ options ) ; } if ( is_object ( $ value ) ) { return static :: _objectToString ( $ value , $ options ) ; } return static :: dump ( $ value , $ options [ 'quote' ] ) ; }
Generate a string representation of arbitrary data.

@param  mixed $value   The data to dump in string.
@param  array  $options Available options are:
- `'quote'` : dump will quote string data if true (default `true`).
- `'object'`: dump options for objects.
- `'method'`: default method to call on string instance (default `__toString`).
- `'array'` : dump options for arrays.
- `'indent'`: level of indent (defaults to `1`).
- `'char'`: indentation character.
- `'multiplier'`: number of indentation character per indent (default `4`)
@return string The dumped string.
Generate a string representation of arbitrary data .