Save the contents of the storage file.

@param array $contents
356338
protected function saveContents($contents)
    {
        $this->contents = $contents;

        try {
            $this->getFilesystem()->put($this->getFilepath(), json_encode($contents));
        } catch (Exception $e) {
            // ...
        }
    }
568757
public function setContent($content)
    {
        if (is_array($content)) {
            $this->setContentType('json');
            $this->_content = json_encode($content, JSON_PRETTY_PRINT);
        } else {
            $this->_content = (string) $content;
        }
    }
871937
public function save($content)
    {
        $content = $this->_getHeader() . $content;
        $result  = file_put_contents($this->_resultFile, $content);

        if (!$result) {
            throw new Exception('JBZoo/Less: File not save - ' . $this->_resultFile); // @codeCoverageIgnore
        }
    }
576174
public function save($filePath = null) {
		
		// Determine the correct file path.
		$filePath = ($filePath == null) ? $this->configFilePath : $filePath;
		
		// Store the file
		file_put_contents ( $filePath, $this->getConfigFileText () );
	}
1199560
public function setContent($content)
    {

        if ($content instanceof FileInterface) {
            $content = $content->load();
        }

        if (is_file($content) && is_readable($content)) {
            $content = file_get_contents($content);
        }

        $this->rawContent = $content;
        $this->parser->setContent($this->rawContent);
    }
1253938
private function save(MutableBag $contents)
    {
        try {
            $this->filesystem->dumpFile(static::FILENAME, Yaml::dump($contents->toArray()));
            $this->io->success('Added the site bundle to .bolt.yml');
        } catch (IOException $e) {
            $this->io->error('Unable to add the site bundle to .bolt.yml');
        }
    }
1154980
public function handle($filename, $contents)
    {
        return $this->filesystem->has($filename) ? $this->filesystem->update($filename, $contents) : $this->filesystem->write($filename, $contents);
    }
1217062
public function saveContents($contents)
    {

        $path = pathinfo($this->configFileLocation);

        //BACKUP CURRENT config.php
        $backup = $this->backupPath.'/pluginconfig.'.date('Y_m_d_His').'.php';
        FileSystemUtils::safeCopy($this->configFileLocation, $backup);

        //OVERWRITE config.php WITH POSTED CONTENTS
        FileSystemUtils::safeFilePutContents($this->configFileLocation, $contents);

        $this->VersionService->incrementDeploymentRevision('Saved config.php');

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

        return file_put_contents($path, $contents);
    }
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));
    }
1107598
static function write($filename, $contents, $overwriteExisting = true) {
        if (file_exists($filename) && self::isWritable($filename)) {
            if ($overwriteExisting) unlink($filename);
        }

        file_put_contents($filename, $contents);
    }
1049056
protected function setContents(array $contents)
    {
        $loopCtr = 0;
        if($contents && is_array($contents))
        {
            foreach($contents as $attrib => $values)
            {
                if($this->_defaultTab == $loopCtr)
                {
                    $this->_contents .= '<div class="tab-pane active" id="'.$values['id'].'"><div class="row"><div class="col-md-12">'.$values['content'].'</div></div></div>';
                }
                else 
                {
                    $this->_contents .= '<div class="tab-pane" id="'.$values['id'].'"><div class="row"><div class="col-md-12">'.$values['content'].'</div></div></div>';
                }

                $loopCtr++;
            }
        }
        
    }
220682
public function save()
    {
        if (file_exists($this->getPath())) {
            $this->setContent($this->encode());
            
            file_put_contents($this->getPath(), $this->getContent());
            
            return;
        }
    }
1048472
public function save($contents)
	{
		// get the formatted output
		$output = $this->export_format($contents);

		if ( ! $output)
		{
			return false;
		}

		if ( ! $path = \Finder::search('config', $this->file, $this->ext))
		{
			if ($pos = strripos($this->file, '::'))
			{
				// get the namespace path
				if ($path = \Autoloader::namespace_path('\\'.ucfirst(substr($this->file, 0, $pos))))
				{
					// strip the namespace from the filename
					$this->file = substr($this->file, $pos+2);

					// strip the classes directory as we need the module root
					$path = substr($path,0, -8).'config'.DS.$this->file.$this->ext;
				}
				else
				{
					// invalid namespace requested
					return false;
				}
			}
		}

		// absolute path requested?
		if ($this->file[0] === '/' or (isset($this->file[1]) and $this->file[1] === ':'))
		{
			$path = $this->file;
		}

		// make sure we have a fallback
		$path or $path = APPPATH.'config'.DS.$this->file.$this->ext;

		$path = pathinfo($path);
		if ( ! is_dir($path['dirname']))
		{
			mkdir($path['dirname'], 0777, true);
		}

		$return = \File::update($path['dirname'], $path['basename'], $output);
		if ($return)
		{
			try
			{
				\Config::load('file', true);
				chmod($path['dirname'].DS.$path['basename'], \Config::get('file.chmod.files', 0666));
			}
			catch (\PhpErrorException $e)
			{
				// if we get something else then a chmod error, bail out
				if (substr($e->getMessage(),0,8) !== 'chmod():')
				{
					throw new $e;
				}
			}
		}
		return $return;
	}
329176
protected function save( $contents ) {
		if ( ! trim( $contents ) ) {
			throw new Exception( 'Cannot save the config file with empty contents.' );
		}

		if ( $contents === $this->wp_config_src ) {
			return false;
		}

		$result = file_put_contents( $this->wp_config_path, $contents, LOCK_EX );

		if ( false === $result ) {
			throw new Exception( 'Failed to update the config file.' );
		}

		return true;
	}
666173
private static function saveToFile($path, $contents)
    {
        $directory = pathinfo($path, PATHINFO_DIRNAME);
        if (!file_exists($directory)) {
            mkdir($directory, 0777, true);
        }
        file_put_contents($path, $contents);
    }
292529
public function storeContents($directory, array $contents, $recursive = false)
    {
        $directories = [$directory];

        foreach ($contents as $object) {
            $this->updateObject($object['path'], $object);
            $object = $this->cache[$object['path']];

            if ($recursive && $this->pathIsInDirectory($directory, $object['path'])) {
                $directories[] = $object['dirname'];
            }
        }

        foreach (array_unique($directories) as $directory) {
            $this->setComplete($directory, $recursive);
        }

        $this->autosave();
    }