Saves $compiled to $file.

@param $file     string The file name in cache.
@param $compiled string The cache content.

@return mixed
427758
public function save($file, $compiled)
    {
        $this->temporaryFileManager->enterModule('Templating');

        $this->temporaryFileManager->save($file . '.php', $compiled);
        $this->temporaryFileManager->exitModule();
    }
1170849
public function save()
    {
        /** @var CompiledYamlFile $file */
        $file = $this->file();
        if (!$file || !$file->filename()) {
            user_error(__CLASS__ . ': calling \$user = new ' . __CLASS__ . "() is deprecated since Grav 1.6, use \$grav['accounts']->load(\$username) or \$grav['accounts']->load('') instead", E_USER_DEPRECATED);
        }

        if ($file) {
            $username = $this->get('username');

            if (!$file->filename()) {
                $locator = Grav::instance()['locator'];
                $file->filename($locator->findResource('account://' . mb_strtolower($username) . YAML_EXT, true, true));
            }

            // if plain text password, hash it and remove plain text
            $password = $this->get('password');
            if ($password) {
                $this->set('hashed_password', Authentication::create($password));
                $this->undef('password');
            }

            $data = $this->items;
            unset($data['username'], $data['authenticated'], $data['authorized']);

            $file->save($data);
        }
    }
685771
public function save($file, $replace = true) {
        $header['Content-Type'] = $file['type'];
        $header['Content-MD5'] 	= $file['md5'];
        $header['Mkdir'] = 'true';
        $resource = fopen($file['tmp_name'], 'r');

        $save = $this->rootPath . $file['savepath'] . $file['savename'];
        $data = $this->request($save, 'PUT', $header, $resource);
        return false === $data ? false : true;
    }
609363
public function saveAsFile($file, $folder = null)
    {
        $fs = new Filesystem($file, $folder);
        $objWriter = \PHPExcel_IOFactory::createWriter($this->excel, 'Excel2007');
        $objWriter->save($fs->getAbsolutePath());
        return $fs->getAbsolutePath();
    }
746280
protected function saveToCache(array $data)
    {
        $cacheDir = dirname($this->cacheFile);

        if (! is_dir($cacheDir) || ! is_writable($cacheDir)) {
            throw new \RuntimeException(sprintf(
                'Invalid cache directory "%s": directory does not exist or not writable.',
                $cacheDir
            ));
        }

        return file_put_contents(
            $this->cacheFile,
            '<?php return ' . var_export($data, true) . ';'
        );
    }
690207
public static function create($file)
    {
        // Verify ZipArchive is installed
        $zipArchive = class_exists('ZipArchive');

        try {
            return self::makeZipArchiver($file, ! $zipArchive, true);
        } catch ( Exception $e ) {
            return self::makeZipArchiver($file, $zipArchive, true);
        }
    }
933424
private function saveContent($file, $content)
    {
        if (file_put_contents($file, $content, LOCK_EX) === false) {
            throw new RuntimeException('Plugin Manager is not able to save ' . $file . '.'); // @codeCoverageIgnore
        }
    }
757240
public function save($file = null)
    {
        //argument 1 must be a file or null
        Argument::i()->test(1, 'string', 'null');
        
        if (is_null($file)) {
            $file = $this->file;
        }
        
        if (is_null($file)) {
            Exception::i()
                ->setMessage(Argument::INVALID_ARGUMENT)
                ->addVariable(1)
                ->addVariable(__CLASS__.'->'.__FUNCTION__)
                ->addVariable('file or null')
                ->addVariable($file)
                ->setTypeLogic()
                ->trigger();
        }
        
        File::i($file)->setData($this->language);
        
        return $this;
    }
1251607
public function compileFile($path)
    {
        $path = $this->resolve($path);

        return $this->compile($this->getFileContents($path), $path);
    }
728665
protected function saveToFile(string $data, string $file):bool{

		if(!\is_writable(\dirname($file))){
			throw new QRCodeOutputException('Could not write data to cache file: '.$file);
		}

		return (bool)\file_put_contents($file, $data);
	}
999880
public function storeFile($file)
    {
        $filename = md5($this->id);
        $data = file_get_contents($file->tmp_name);

        if ($this->getFileName() == $this->name) {
            $this->name = $file->name;
        }

        $file->append(array(
            'type' => mime_content_type($file->name),
        ));

        $this->mimeType = $file->type;
        $this->setValue('file_name', $file->name);
        $this->fileSize = strlen($data);
        $this->writeData($filename, $data, false);
    }
536797
public function toFile($file)
    {
        $composer = json_decode(file_get_contents($file), true);

        // Remove the zendframework/zendframework
        unset($composer['require']['zendframework/zendframework']);

        // Add all the found components
        foreach (array_keys($this->components) as $component) {
            $composer['require']['zendframework/' . $component] = $this->version;
        }

        file_put_contents($file, json_encode($composer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
    }
209556
private function cache($file, $layout=false)
	{
        if(!$this->config['compiler']){
            return $file;
        }

		return (new Cache([
            'path' => $this->config['cache']
        ]))->compiled($file, $file, $this->setCacheCompiler($file, $layout));
	}
921457
public function getCompiledFile() {
		if($this->compiledFile === null)
			$this->compiledFile = $this->params['root'].'/storage/compiled.php';#default path
		return $this->compiledFile;
	}
277821
public function toFile($file)
	{
		$minified = $this->minify();

		// Create dir
		$dir = dirname($file);

		if (!is_dir($dir))
		{
			if (is_file($dir))
			{
				throw new \RuntimeException(sprintf('Path: %s is already a file.', $dir));
			}

			if (!@mkdir($dir, 0755, true) && !is_dir($dir))
			{
				throw new \RuntimeException(sprintf('Auto create dir: %s fail.', $dir));
			}
		}

		file_put_contents($file, $minified);

		return $this;
	}
437249
public function renderFile($file)
    {
        if (!is_file($file)) {
            throw new \RuntimeException(sprintf('View cannot render file "%s" does not exist', $file));
        }

        ob_start();
        ob_implicit_flush(false);

        require $file;
        return ob_get_clean();
    }
1351301
public function getCompiledFile($template)
	{	
		$tplFile = static::getTemplateFile($template);
		if ($this->options['engine'] === 'php'){
			return $tplFile;
		}
		
		if(file_exists($tplFile)) {
		    if (is_file($template)) {
		        $tplCompiledFile = static::getCompiledPath() . '/_file/' . md5($template) . '.php';
		    } else {
                $tplCompiledFile = static::getCompiledPath() . $this->_getRelativeTemplate($template) . '.php';
		    }
		    
			if (!$this->options['isCompiled'] || !file_exists($tplCompiledFile) || (@filemtime($tplFile) > @filemtime($tplCompiledFile)) ) {
				$tplCompiledPath = dirname($tplCompiledFile);
				if (!file_exists($tplCompiledPath)) {
					Dir::create($tplCompiledPath, 0755);
				}
				
				$content = file_get_contents($tplFile);
				$content = $this->parse($content);
				
				$strlen = file_put_contents($tplCompiledFile, $content);
				chmod ($tplCompiledFile, 0755);
			}
			
			return $tplCompiledFile;
		} else {
			throw new ViewException('template: ' . $tplFile. ' is not exists.');
		}
	}