src/Storage/FileStorage.php
public static function writeFile($fileName, $data, $options = [])
    {
        $writer = new File\FileWriter($fileName, $options);
        $isSuccess = true;
        $written = 0;

        try {
            $writer->open();
            $written = $writer->write($data);
        } catch (\RuntimeException $e) {
            self::$lastError = $e->getMessage();
            $isSuccess = false;
        }

        try {
            $writer->close();
        } catch (\RuntimeException $e) {
            self::$lastError = $e->getMessage();
            $isSuccess = false;
        }

        return $isSuccess;
    }
public static function writeFile($fileName, $data, $options = [])
    {
        $writer = new File\FileWriter($fileName, $options);
        $isSuccess = true;
        $written = 0;

        try {
            $writer->open();
            $written = $writer->write($data);
        } catch (\RuntimeException $e) {
            self::$lastError = $e->getMessage();
            $isSuccess = false;
        }

        try {
            $writer->close();
        } catch (\RuntimeException $e) {
            self::$lastError = $e->getMessage();
            $isSuccess = false;
        }

        return $isSuccess;
    }
public static function writeFile ( $ fileName , $ data , $ options = [ ] ) { $ writer = new File \ FileWriter ( $ fileName , $ options ) ; $ isSuccess = true ; $ written = 0 ; try { $ writer -> open ( ) ; $ written = $ writer -> write ( $ data ) ; } catch ( \ RuntimeException $ e ) { self :: $ lastError = $ e -> getMessage ( ) ; $ isSuccess = false ; } try { $ writer -> close ( ) ; } catch ( \ RuntimeException $ e ) { self :: $ lastError = $ e -> getMessage ( ) ; $ isSuccess = false ; } return $ isSuccess ; }
Writes data to a file

@param string $fileName Name of the file
@param string $data File contents to write
@param array $options Options for the Writer instance
@return bool Was the write operation successful
Writes data to a file