public function dump($key, array $data)
    {
        $result = [];
        foreach ($data as $k => $value) {
            $isSection = false;
            if ($k[0] !== '[') {
                $result[] = "[$k]";
                $isSection = true;
            }
            if (is_array($value)) {
                $kValues = Hash::flatten($value, '.');
                foreach ($kValues as $k2 => $v) {
                    $result[] = "$k2 = " . $this->_value($v);
                }
            }
            if ($isSection) {
                $result[] = '';
            }
        }
        $contents = trim(implode("\n", $result));

        $filename = $this->_getFilePath($key);

        return file_put_contents($filename, $contents) > 0;
    }
public function dump($key, array $data)
    {
        $result = [];
        foreach ($data as $k => $value) {
            $isSection = false;
            if ($k[0] !== '[') {
                $result[] = "[$k]";
                $isSection = true;
            }
            if (is_array($value)) {
                $kValues = Hash::flatten($value, '.');
                foreach ($kValues as $k2 => $v) {
                    $result[] = "$k2 = " . $this->_value($v);
                }
            }
            if ($isSection) {
                $result[] = '';
            }
        }
        $contents = trim(implode("\n", $result));

        $filename = $this->_getFilePath($key);

        return file_put_contents($filename, $contents) > 0;
    }
public function dump ( $ key , array $ data ) { $ result = [ ] ; foreach ( $ data as $ k => $ value ) { $ isSection = false ; if ( $ k [ 0 ] !== '[' ) { $ result [ ] = "[$k]" ; $ isSection = true ; } if ( is_array ( $ value ) ) { $ kValues = Hash :: flatten ( $ value , '.' ) ; foreach ( $ kValues as $ k2 => $ v ) { $ result [ ] = "$k2 = " . $ this -> _value ( $ v ) ; } } if ( $ isSection ) { $ result [ ] = '' ; } } $ contents = trim ( implode ( "\n" , $ result ) ) ; $ filename = $ this -> _getFilePath ( $ key ) ; return file_put_contents ( $ filename , $ contents ) > 0 ; }
Dumps the state of Configure data into an ini formatted string.

@param string $key The identifier to write to. If the key has a . it will be treated
as a plugin prefix.
@param array $data The data to convert to ini file.
@return bool Success.
Dumps the state of Configure data into an ini formatted string .