src/config/Config.php
public function dump(array $options = null) {
        $lines = [];
        $maxKeyLength = 0;
        $values = $this->dumpNode([], $this->properties, $maxKeyLength);

        if (isset($options['sort'])) {
            if ($options['sort'] == SORT_ASC) {
                ksort($values, SORT_NATURAL);
            }
            else if ($options['sort'] == SORT_DESC) {
                krsort($values, SORT_NATURAL);
            }
        }

        foreach ($values as $key => &$value) {
            // convert special values to their string representation
            if     (is_null($value)) $value = '(null)';
            elseif (is_bool($value)) $value = ($value ? '(true)' : '(false)');
            elseif (is_string($value)) {
                switch (strtolower($value)) {
                    case  'null'  :
                    case '(null)' :
                    case  'true'  :
                    case '(true)' :
                    case  'false' :
                    case '(false)':
                    case  'on'    :
                    case  'off'   :
                    case  'yes'   :
                    case  'no'    :
                        $value = '"'.$value.'"';
                        break;
                    default:
                        if (strContains($value, '#'))
                            $value = '"'.$value.'"';
                }
            }
            $value = str_pad($key, $maxKeyLength, ' ', STR_PAD_RIGHT).' = '.$value;
        }; unset($value);
        $lines += $values;

        $padLeft = isset($options['pad-left']) ? $options['pad-left'] : '';

        return $padLeft.join(NL.$padLeft, $lines);
    }
public function dump(array $options = null) {
        $lines = [];
        $maxKeyLength = 0;
        $values = $this->dumpNode([], $this->properties, $maxKeyLength);

        if (isset($options['sort'])) {
            if ($options['sort'] == SORT_ASC) {
                ksort($values, SORT_NATURAL);
            }
            else if ($options['sort'] == SORT_DESC) {
                krsort($values, SORT_NATURAL);
            }
        }

        foreach ($values as $key => &$value) {
            // convert special values to their string representation
            if     (is_null($value)) $value = '(null)';
            elseif (is_bool($value)) $value = ($value ? '(true)' : '(false)');
            elseif (is_string($value)) {
                switch (strtolower($value)) {
                    case  'null'  :
                    case '(null)' :
                    case  'true'  :
                    case '(true)' :
                    case  'false' :
                    case '(false)':
                    case  'on'    :
                    case  'off'   :
                    case  'yes'   :
                    case  'no'    :
                        $value = '"'.$value.'"';
                        break;
                    default:
                        if (strContains($value, '#'))
                            $value = '"'.$value.'"';
                }
            }
            $value = str_pad($key, $maxKeyLength, ' ', STR_PAD_RIGHT).' = '.$value;
        }; unset($value);
        $lines += $values;

        $padLeft = isset($options['pad-left']) ? $options['pad-left'] : '';

        return $padLeft.join(NL.$padLeft, $lines);
    }
public function dump ( array $ options = null ) { $ lines = [ ] ; $ maxKeyLength = 0 ; $ values = $ this -> dumpNode ( [ ] , $ this -> properties , $ maxKeyLength ) ; if ( isset ( $ options [ 'sort' ] ) ) { if ( $ options [ 'sort' ] == SORT_ASC ) { ksort ( $ values , SORT_NATURAL ) ; } else if ( $ options [ 'sort' ] == SORT_DESC ) { krsort ( $ values , SORT_NATURAL ) ; } } foreach ( $ values as $ key => & $ value ) { // convert special values to their string representation if ( is_null ( $ value ) ) $ value = '(null)' ; elseif ( is_bool ( $ value ) ) $ value = ( $ value ? '(true)' : '(false)' ) ; elseif ( is_string ( $ value ) ) { switch ( strtolower ( $ value ) ) { case 'null' : case '(null)' : case 'true' : case '(true)' : case 'false' : case '(false)' : case 'on' : case 'off' : case 'yes' : case 'no' : $ value = '"' . $ value . '"' ; break ; default : if ( strContains ( $ value , '#' ) ) $ value = '"' . $ value . '"' ; } } $ value = str_pad ( $ key , $ maxKeyLength , ' ' , STR_PAD_RIGHT ) . ' = ' . $ value ; } ; unset ( $ value ) ; $ lines += $ values ; $ padLeft = isset ( $ options [ 'pad-left' ] ) ? $ options [ 'pad-left' ] : '' ; return $ padLeft . join ( NL . $ padLeft , $ lines ) ; }
Return a plain text dump of the instance's preferences.

@param  array $options [optional] - array with dump options: <br>
'sort'     => SORT_ASC|SORT_DESC (default: unsorted) <br>
'pad-left' => string             (default: no padding) <br>
@return string
Return a plain text dump of the instance s preferences .