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;
    }