Writes file.
@param string $file
@param array $data
340019
protected function saveFile($file, array $data)
    {
        $path = $this->getVendorDir() . '/' . $file;
        if (!file_exists(dirname($path))) {
            mkdir(dirname($path), 0777, true);
        }
        $array = str_replace("'" . self::BASE_DIR_SAMPLE, '$baseDir . \'', Helper::exportVar($data));
        file_put_contents($path, "<?php\n\n\$baseDir = dirname(dirname(__DIR__));\n\nreturn $array;\n");
    }
845776
public static void writeByteArrayToFile(final File file, final byte[] byteArray)
		throws IOException
	{
		try (FileOutputStream fos = new FileOutputStream(file);
			BufferedOutputStream bos = new BufferedOutputStream(fos))
		{
			bos.write(byteArray);
		}
		catch (final FileNotFoundException ex)
		{
			throw ex;
		}
		catch (final IOException ex)
		{
			throw ex;
		}
	}
809808
protected function _fwrite($data, $length=null)
    {
        // We do not need to check if file position points to the end of "file".
        // Only append operation is supported now

        if ($length !== null) {
            $this->_data .= substr($data, 0, $length);
        } else {
            $this->_data .= $data;
        }

        $this->_position = strlen($this->_data);
    }
1314026
public function save(string $id, array $data)
    {
        $this->setFile($id);
        if ($this->file) {
            if (file_exists($this->file)) {
                $this->update($id, $data);
            } else {
                $this->add($id, $data);
            }
        }
    }
380649
static function write_sections($file, $data)
	{
		$content = "";
		foreach($data as $section => $section_data)
		{
			$content .= "[".$section."]\n";
			foreach($section_data as $key => $value)
			{
				if(is_array($value))
				{
					for($i=0; $i<count($value); $i++)
						$content .= $key."[] = \"".addslashes($value[$i])."\"\n";
				}
				elseif($value)
					$content .= $key." = \"".addslashes($value)."\"\n";
				else
					$content .= $key." = \n";
			}
		}

		bors_function_include('fs/file_put_contents_lock');
		file_put_contents_lock($file, $content);
	}
461529
protected function writeFileProcess( string $file, \Closure $data, bool $append = false )
	{
		return $this->write(
			$file, $data, $append
		);
	}
180184
protected function writeToFile($file, $content)
    {
        if (!function_exists('gzopen')) {
            throw new \Exception('metaseo needs zlib support');
        }

        $fp = gzopen($file, 'w');

        if ($fp) {
            gzwrite($fp, $content);
            gzclose($fp);
        } else {
            throw new \Exception('Could not open ' . $file . ' for writing');
        }
    }
837896
public function write(string $data) : void
    {
        $this->buffer .= $data;

        if (strlen($this->buffer) >= $this->size) {
            $this->flush();
        }
    }
657986
public static function append(String $file, String $data) : Int
    {
        return file_put_contents(Info::rpath($file), $data, FILE_APPEND);
    }
1236199
public static void write(final Hml data, final File file) throws IOException {
        checkNotNull(data);
        checkNotNull(file);
        try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
            write(data, writer);
        }
    }
712899
public function init($file, array $data = null)
    {
        if ($data === null) {
            $data = $this->setJsonDefaults([]);
        }
        $this->app['filesystem']->write($file, Json::dump($data, Json::HUMAN));
    }
263230
static function write($file, $data)
	{
		$content = "";
		foreach($data as $key => $value)
		{
			if(is_array($value))
			{
				for($i=0; $i<count($value); $i++)
					$content .= $key."[] = \"".addslashes($value[$i])."\"\n";
			}
			elseif($value)
				$content .= $key." = \"".addslashes($value)."\"\n";
			else
				$content .= $key." = \n";
		}

		bors_function_include('fs/file_put_contents_lock');
		file_put_contents_lock($file, $content);
	}
696610
public static File writeDataToFile(final byte[] data, final File file, final boolean append) {
		try (FileOutputStream out = new FileOutputStream(file, append)) {
			out.write(data);
			out.flush();
			out.close();
			return file;
		} catch (Exception e) {
			JKExceptionUtil.handle(e);
			return null;
		}
	}
130807
protected function writeFile( string $file, string $data, bool $append = false )
	{
		return $this->write(
			$file, $data, $append
		);
	}
1352773
public function write($file)
    {
        if (file_exists($file) && !is_writable($file)) {
            throw new RuntimeException("$file is not writable");
        }
        $fp = fopen($file, 'w');
        foreach ($this->lines as $line) {
            fwrite($fp, $line['data']);
        }
        fclose($fp);
    }
106477
public static function write(string $file = '', string $data = '', bool $doAppend = false): bool
    {
        $result = false;
        $file = static::normalizePath($file);
        if (static::verifyPath($file) && Directory::create(\dirname($file))) {
            $flags = $doAppend ? FILE_APPEND : 0;
            $flags |= static::$writeLocks ? LOCK_EX : 0;

            $result = @\file_put_contents($file, $data, $flags) !== false;
            @\chmod($file, static::$newFileMode);
        }
        return $result;
    }
872788
public static void writeToFile(final File fileNode, final byte[] data) throws FrameworkException, IOException {

		setFileProperties(fileNode);

		FileUtils.writeByteArrayToFile(fileNode.getFileOnDisk(), data);

	}