public function write($directory = null)
    {
        $file = $this->getFilename();

        if ($directory === null) {
            $directory = dirname($file);
            $file = basename($file);
        }

        $file = $directory . DIRECTORY_SEPARATOR . $file;
        if (is_writable($directory) !== true) {
            throw new RuntimeException('The file "' . $file . '" is not writable.');
        }

        file_put_contents($file, $this->generate());

        return $this;
    }
public function write($directory = null)
    {
        $file = $this->getFilename();

        if ($directory === null) {
            $directory = dirname($file);
            $file = basename($file);
        }

        $file = $directory . DIRECTORY_SEPARATOR . $file;
        if (is_writable($directory) !== true) {
            throw new RuntimeException('The file "' . $file . '" is not writable.');
        }

        file_put_contents($file, $this->generate());

        return $this;
    }
public function write ( $ directory = null ) { $ file = $ this -> getFilename ( ) ; if ( $ directory === null ) { $ directory = dirname ( $ file ) ; $ file = basename ( $ file ) ; } $ file = $ directory . DIRECTORY_SEPARATOR . $ file ; if ( is_writable ( $ directory ) !== true ) { throw new RuntimeException ( 'The file "' . $ file . '" is not writable.' ) ; } file_put_contents ( $ file , $ this -> generate ( ) ) ; return $ this ; }
Write the code to the file.

@param string $directory The directory where to put the file. If NULL then only the filename is used.
@return \Wingu\OctopusCore\CodeGenerator\AbstractGenerator
@throws \Wingu\OctopusCore\CodeGenerator\Exceptions\RuntimeException If the file is not writable.
Write the code to the file .