code/object/config/format.php
public function toFile($filename)
    {
        $directory = dirname($filename);

        if(empty($filename)) {
            throw new \InvalidArgumentException('No file name specified');
        }

        if (!is_dir($directory)) {
            throw new \RuntimeException(sprintf('Directory : %s does not exists!', $directory));
        }

        if (!is_writable($directory)) {
            throw new \RuntimeException(sprintf("Cannot write in directory : %s", $directory));
        }

        $result = file_put_contents($filename, $this->toString(), LOCK_EX);

        if($result === false) {
            throw new \RuntimeException(sprintf("Error writing to %s", $filename));
        }
    }
public function toFile($filename)
    {
        $directory = dirname($filename);

        if(empty($filename)) {
            throw new \InvalidArgumentException('No file name specified');
        }

        if (!is_dir($directory)) {
            throw new \RuntimeException(sprintf('Directory : %s does not exists!', $directory));
        }

        if (!is_writable($directory)) {
            throw new \RuntimeException(sprintf("Cannot write in directory : %s", $directory));
        }

        $result = file_put_contents($filename, $this->toString(), LOCK_EX);

        if($result === false) {
            throw new \RuntimeException(sprintf("Error writing to %s", $filename));
        }
    }
public function toFile ( $ filename ) { $ directory = dirname ( $ filename ) ; if ( empty ( $ filename ) ) { throw new \ InvalidArgumentException ( 'No file name specified' ) ; } if ( ! is_dir ( $ directory ) ) { throw new \ RuntimeException ( sprintf ( 'Directory : %s does not exists!' , $ directory ) ) ; } if ( ! is_writable ( $ directory ) ) { throw new \ RuntimeException ( sprintf ( "Cannot write in directory : %s" , $ directory ) ) ; } $ result = file_put_contents ( $ filename , $ this -> toString ( ) , LOCK_EX ) ; if ( $ result === false ) { throw new \ RuntimeException ( sprintf ( "Error writing to %s" , $ filename ) ) ; } }
Write a config object to a file.

@param  string  $filename
@throws \InvalidArgumentException
@throws \RuntimeException
@return void
Write a config object to a file .