Write Data

@param string $file
@param string $data

@return int
968995
public static function write(String $file, String $data) : Int
    {
        return file_put_contents(Info::rpath($file), $data);
    }
970565
function write( $data, $length = false )
    {
        if ( !$this->isOpen() )
        {
            eZDebug::writeError( "A file is not currently opened, cannot write.", __METHOD__ );
            return false;
        }
        if ( $length < 0 )
        {
            eZDebug::writeError( "length cannot be negative ($length)", __METHOD__ );
            return false;
        }
        return $this->doWrite( $data, $length );
    }
724868
public function writeFile($file, $content)
    {
        $this->ensureDir(dirname($file));

        file_put_contents($file, $content);
    }
461529
protected function writeFileProcess( string $file, \Closure $data, bool $append = false )
	{
		return $this->write(
			$file, $data, $append
		);
	}
15983
public function stream_write($data)
    {
        if ( ! $this->stream instanceof WritableStream) {
            return 0;
        }

        try {
            return $this->stream->writeBytes($data);
        } catch (Exception $e) {
            trigger_error(sprintf('%s: %s', get_class($e), $e->getMessage()), \E_USER_WARNING);
            return false;
        }
    }
1191778
public function write(string $data): int
    {
        $dataLength    = strlen($data);
        $this->doWrite($data, $this->offset, $dataLength);
        $this->offset += $dataLength;
        return $dataLength;
    }
387177
public function writeToPluginFile($file, $data)
    {
        $this->writeToFile(
            $this->config['plugins'] . Utils::unleadslashit($file),
            $data
        );
    }
869681
public function fileAppend($file, $data)
    {
        $file = $this->alias->resolve($file);
        $this->_dirCreate(dirname($file));

        if (file_put_contents($file, $data, LOCK_EX | FILE_APPEND) === false) {
            throw new RuntimeException(['write `:file` file failed: :last_error_message', 'file' => $file]);
        }
    }
487028
public function write(string $bytes): int
    {
        if ($this->isFileCreationDelayed()) {
            $this->setHandle($this->openFile($this->file, $this->mode));
        }

        return parent::write($bytes);
    }
590239
public function write(string $data): int
    {
        if (!$this->connected()) {
            throw new LogicException('Not connected');
        }

        return (int) fwrite($this->connection, $data, strlen($data));
    }
130807
protected function writeFile( string $file, string $data, bool $append = false )
	{
		return $this->write(
			$file, $data, $append
		);
	}
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);
	}
38436
public function writefunction($curl, string $data):int{
		return $this->response->getBody()->write($data);
	}
1150096
public static function prepend(string $file, $data, bool $lock = false)
	{
		return file_put_contents($file, $data . file_get_contents($file), $lock ? LOCK_EX : 0);
	}
236529
public function writeToThemeFile($file, $data)
    {
        $this->writeToFile(
            $this->config['themes'] . Utils::unleadslashit($file),
            $data
        );
    }
712899
public function init($file, array $data = null)
    {
        if ($data === null) {
            $data = $this->setJsonDefaults([]);
        }
        $this->app['filesystem']->write($file, Json::dump($data, Json::HUMAN));
    }
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);
        }
    }