Appends content to an existing file.

@param string          $filename The file to which to append content
@param string|resource $content  The content to append

@throws IOException If the file is not writable
556401
public function appendToFile($filename, $content)
    {
        if (\is_array($content)) {
            @trigger_error(sprintf('Calling "%s()" with an array in the $content argument is deprecated since Symfony 4.3.', __METHOD__), E_USER_DEPRECATED);
        }

        $dir = \dirname($filename);

        if (!is_dir($dir)) {
            $this->mkdir($dir);
        }

        if (!is_writable($dir)) {
            throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
        }

        if (false === @file_put_contents($filename, $content, FILE_APPEND)) {
            throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
        }
    }
331191
public static function putContents($filename, $contents)
    {
        $result = file_put_contents($filename, $contents, \LOCK_EX | \LOCK_NB);
        if ($result === false) {
            throw new \RuntimeException("Cannot write the file: " . $filename);
        }
    }
250441
protected function write($content, $file)
    {
        if (file_exists($file)) { // Do not create a new file
            return file_put_contents($file, $content) !== false;
        }

        return false;
    }
472178
public static function append(string $file, string $content): int
    {
        if (!self::exists(dirname($file))) {
            self::mkDir(dirname($file));
        }
        return file_put_contents($file, $content, FILE_APPEND);
    }
327760
protected function putFile($to, $content)
    {
        $to = $this->extensionPath($to);

        $this->filesystem->put($to, $content);
    }
1090044
public function append($file, $content)
    {
        $stream = fopen('php://temp', 'r+');
        fwrite($stream, $content);
        rewind($stream);

        // prevent ftp_fput from seeking local "file" ($h)
        ftp_set_option($this->getConnection(), FTP_AUTOSEEK, false);

        $size = ftp_size($this->getConnection(), $file);
        $result = ftp_fput($this->getConnection(), $file, $stream, $this->transfer_mode, $size);
        fclose($stream);

        return $result;
    }
64170
public void write(String filename, String content) throws IOException {
    FSDataOutputStream s = getMfs().create(new Path(filename));
    s.writeBytes(content);
    s.close();
  }
617427
public function write(string $filename, string $contents): int
    {
        return (int)file_put_contents($filename, $contents);
    }
162568
public function save($content, $fileName) {
        $this->renderer = new Png();
        $this->renderer->setHeight($this->width);
        $this->renderer->setWidth($this->height);
        $writer = new Writer($this->renderer);

        $writer->writeFile($content, $fileName);

        return true;
    }
360342
public function save($filename, $content) {
        if ($this->driver) {
            return $this->driver->save($filename, $content);
        }

        return false;
    }
952579
public static function append($string, $filename)
    {
        $context = stream_context_create();
        $fp = fopen($filename, 'r', 1, $context);
        $tmpname = md5($string);
        file_put_contents($tmpname, $fp);
        file_put_contents($tmpname, $string, FILE_APPEND);
        fclose($fp);
        unlink($filename);
        rename($tmpname, $filename);
    }
794659
public static function prepend(string $filename, string $content): int
    {
        if (self::exist($filename)) {
            return self::put($filename, $content . self::get($filename));
        }
        return self::put($filename, $content);
    }
781342
public function put($filename, $content)
    {
        // Merge existing content to new content
        if (file_exists($this->cacheDir . $filename) && file_get_contents($this->cacheDir . $filename) != '') {
            $cachedContent = $this->get($filename);
            $content       = array_merge($content, $cachedContent);
        }
        $this->files->put($this->cacheDir . $filename, json_encode($content));
    }
108796
public function appendToFile($content)
    {
        $result = @fwrite($this->_file, $content);

        if ($result === false) {
            throw new Exception("I'm can not wrtite to file");
        }

        return $result;
    }
1161144
public static function append( $path, $content ) 
	{
		if ( !is_dir( dirname( $path ) ) ) 
		{
			if ( !mkdir( dirname( $path ), 0755, true ) ) 
			{
				throw new CCException( "CCFile - could not create directory: ".dirname( $path ) );
			}
		}
		return file_put_contents( $path, $content, LOCK_EX | FILE_APPEND );
	}
661410
protected function _updateFile($fileName, $content)
    {
        $oldContent = null;
        if (file_exists($fileName)) {
            $oldContent = file_get_contents($fileName);
        }

        if ($content !== $oldContent) {
            file_put_contents($fileName, $content);
        }

        return $fileName;
    }
144815
public static File appendString(String content, File file, String charset) throws IORuntimeException {
		return FileWriter.create(file, CharsetUtil.charset(charset)).append(content);
	}