Put contents into a file.

@param $file
@param $contents
173314
public function putFile($file, $contents)
    {
        $this->mkdir(dirname($file));

        file_put_contents($file, $contents);
    }
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);
        }
    }
896202
public function compactContents($file, $contents)
    {
        foreach ($this->compactors as $compactor) {
            /** @var $compactor CompactorInterface */
            if ($compactor->supports($file)) {
                $contents = $compactor->compact($contents);
            }
        }

        return $contents;
    }
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;
    }
764625
public function upload($file, $destination = null)
    {
        if (!file_exists($file)) {
            return;
        }

        // Get contents and destination
        $destination = $destination ?: basename($file);

        $this->put($destination, file_get_contents($file));
    }
1002801
public function put($path, $contents)
    {
        $this->makeDirectory(dirname($path));

        return file_put_contents($path, $contents);
    }
62233
public function mkFile($files)
    {
        foreach ($files as $file) {
            if (!is_file($file)) {
                @mkdir(dirname($file), 0777, true);
                file_put_contents($file, "<?php\n\nreturn [];\n");
            }
        }
    }
1288790
public function putContent($file, $contents, $mode = '0640')
	{
		$path = dirname($file);

		if (!is_dir($path))
		{
			if (!@mkdir($path, 0750))
			{
				return false;
			}
		}

		$result = @file_put_contents($file, $contents);

		if ($result)
		{
			@chmod($file, octdec($mode));
		}

		return $result;
	}
136168
protected function writeFile(string $cacheFile, string $contents): bool
    {
        $dir = dirname($cacheFile);

        if ($dir !== $this->cacheDir && !is_dir($dir)) {
            mkdir($dir, 0775, true);
        }

        return (bool)file_put_contents($cacheFile, $contents);
    }
754852
public function write($file = "")
    {
        $iniString = $this->generateIniString($this->config);
        file_put_contents($file ? $file : $this->filePath, $iniString);
    }
391649
public function write( $key, $contents ) {
		$filename = $this->prepare_write( $key );

		if ( $filename ) {
			return file_put_contents( $filename, $contents ) && touch( $filename );
		}

		return false;
	}
402189
public function addResource(string $file): void
    {
        $contents = file_get_contents($file);
        
        if ($contents === false) {
            throw new \RuntimeException("Error reading file at $file.");
        }
        
        $this->processData(json_decode($contents, true));
    }
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);
    }
910766
public function write ($content)
	{
		$this->createPath($this->path);
		file_put_contents($this->getName(), $content, FILE_APPEND);
	}
617427
public function write(string $filename, string $contents): int
    {
        return (int)file_put_contents($filename, $contents);
    }
1018464
public function dump($file, $content)
    {
        $fileWrited = file_put_contents($file, '<?php return ' . var_export($content, true) . ';');

        if ($fileWrited === false) {
            throw new \Exception('Unable to dump data into php file !');
        }
    }
665856
public static function put($path, $contents, $lock = false)
    {
        return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
    }