Saves file to filesystem
@param string $filename RELATIVE filename
@param string $contents
512923
public function saveFile ($filename, $contents)
	{
		// make sure the directory exists
		$dirname = $this->reportDir.'/'.dirname ($filename);

		if ($dirname && !is_dir($dirname)) {
			mkdir ($dirname, 0777, true);
		}

		// save
		file_put_contents ($this->reportDir.'/'.$filename, $contents);
	}
601566
public static function touch($filename, $content = '')
    {
        self::mkdir(dirname($filename));
        file_put_contents($filename, $content);
    }
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;
    }
124992
public function save(array $contents)
    {
        // Custom paths
        if (count($contents['paths']) > 0) {
            $str = Yaml::dump($contents);
            try {
                $this->filesystem->dumpFile(static::FILENAME, $str);
                $version = \Bolt\Version::VERSION;
                $this->io->writeError([
                    "<info>Bolt has updated the <comment>paths</comment> in your <comment>.bolt.yml</comment> file for $version.</info>\n",
                ]);
            } catch (IOException $e) {
                $this->io->writeError([
                    'The <comment>paths</comment> in your <comment>.bolt.yml</comment> file can be simplified.',
                    'You should update your <comment>.bolt.yml</comment> file to this:',
                    '',
                    "<info>$str</info>",
                    '',
                ]);
            }

            return;
        }

        $this->io->writeError('The paths in your <comment>.bolt.yml</comment> file match the defaults now.');

        // No custom paths and no other options = delete.
        if ($onlyPaths = !array_diff_key($contents, ['paths' => 0])) {
            try {
                $this->filesystem->remove(static::FILENAME);
                $this->io->writeError("<info>Since this file is optional we've deleted it for you.</info>\n");
            } catch (IOException $e) {
                $this->io->writeError("<info>It is safe to delete it.</info>\n");
            }

            return;
        }

        // No custom paths, but other options.
        try {
            unset($contents['paths']);
            $this->filesystem->dumpFile(static::FILENAME, Yaml::dump($contents));
            $this->io->writeError("<info>We've removed them from the file for you.</info>\n");
        } catch (IOException $e) {
            $this->io->writeError("<info>It is safe and encouraged to remove them.</info>\n");
        }
    }
1109738
public function output(string $filename)
    {
        $basename  = pathinfo($filename, PATHINFO_BASENAME);
        $this->save($basename, true);
    }
723565
protected function write($contents, $assetFileName)
    {
        // Derive the filename that we will be writing to
        $directory = $this->getOutputDirectory($assetFileName);

        // Build the file name
        $filename = self::getOutputFileName($assetFileName);

        // The full file path
        $fullpath = $directory.$filename;

        // Make sure that the folder exists
        if(!file_exists($directory))
        {
            // It doesn't, so make it (allow us to write)
            mkdir($directory, 0777, true);
        }

        // Write the file to disk
        file_put_contents($fullpath, $contents);

        // Return the newly created file name
        return $fullpath;
    }
691534
public function clientWrite($filename, $source)
    {
        $path = $this->clientPath($filename);
        file_put_contents($path, $source);
    }
1097522
public static function writeFile($fileName, $content, $flags = 0)
    {
        if (Coroutine::isIn()) {
            return Coroutine::writeFile($fileName, $content, $flags);
        } else {
            return false !== file_put_contents($fileName, $content, $flags);
        }
    }
301779
public function save($filename)
    {
        $this->setFilename($filename);

        call_user_func_array($this->getFunctionName(), [$this->getImage(), $filename]);

        return $filename;
    }
69445
public function saveHTMLFile($filename)
    {
        if (!is_writable($filename)) {
            return false;
        }
        $result = $this->saveHTML();
        file_put_contents($filename, $result);
        $bytesWritten = filesize($filename);
        if ($bytesWritten === strlen($result)) {
            return $bytesWritten;
        }
        return false;
    }
724868
public function writeFile($file, $content)
    {
        $this->ensureDir(dirname($file));

        file_put_contents($file, $content);
    }
1146263
public function write($content) : void
    {
        $this->checkFile();
        $this->checkDir();

        file_put_contents($this->path, $content);
    }
1105272
public function putContents($file, $contents)
    {
        $dir = dirname($file);
        if (! file_exists($dir)) throw new Exception("Can not put contents, not exists dirctory. -> {$dir}");
        file_put_contents($file, $contents);
    }
356338
protected function saveContents($contents)
    {
        $this->contents = $contents;

        try {
            $this->getFilesystem()->put($this->getFilepath(), json_encode($contents));
        } catch (Exception $e) {
            // ...
        }
    }
1107598
static function write($filename, $contents, $overwriteExisting = true) {
        if (file_exists($filename) && self::isWritable($filename)) {
            if ($overwriteExisting) unlink($filename);
        }

        file_put_contents($filename, $contents);
    }
1028445
public function save($filename, $content)
    {
        $this->logs[] = $content;
        $this->storage->save($filename, $content);

        return $this;
    }
816556
public function writeFile(
        string $content,
        string $filename,
        string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING,
        ?ErrorCorrectionLevel $ecLevel = null
    ) : void {
        file_put_contents($filename, $this->writeString($content, $encoding, $ecLevel));
    }