Write a new file.

@param string $path
@param string $contents
@param Config $config Config object

@return array|false false on failure file meta data on success
518531
public function write($path, $contents, Config $config) {
        try {
            $mapping = $this->mapper->get($path);

            $file = null;

            if ($mapping) {
                $volume = $this->client->lookup($mapping['fid']);

                $file = new \stdClass();
                $file->url = $volume->url;
                $file->fid = $mapping['fid'];
            }

            $file = $this->client->upload($contents, basename($path), $file);

            if (!$file) {
                return false;
            }

            $this->mapper->store($path, $file->fid, mimetype_from_filename($path), $file->size);

            return $file->toArray();
        } catch (SeaweedFSException $e) {
            return false;
        }
    }
525372
public function writeStream($path, $resource, Config $config)
    {
        $path = pathinfo($path)['filename'];

        $resource_metadata = stream_get_meta_data($resource);
        $uploaded_metadata = Uploader::upload($resource_metadata['uri'], ['public_id' => $path, 'resource_type' => 'auto']);
        
        return $uploaded_metadata;
    }
234418
public function write($path, $contents, Config $config)
    {
        $location = $this->applyPathPrefix($path);
        $options = $this->getOptionsFromConfig($config);
        return $this->ossClient->putObject($this->bucket, $location, $contents, $options);
    }
228703
public function create($path, $contents='')
    {
        $this->fs[$path] = $this->newFile();
        $this->fs[$path]->setPath($path);
        return $this->fs[$path];
    }
1101741
public static function write($path, $content = null, $flags = null)
    {
        $path = Normalize::diskFullPath($path);

        $pathArray = explode(DIRECTORY_SEPARATOR, $path);
        array_pop($pathArray);
        $pathName = implode(DIRECTORY_SEPARATOR, $pathArray);

        if (!Directory::exist($pathName)) {
            Directory::create($pathName);
        }
        return @file_put_contents($path, $content, $flags);
    }
529434
protected function _write($path, $content)
    {
        $File = new File($path);
        $File->write($content);
        $File->exists();
    }
1337041
public function update($path, $contents, Config $config)
    {
        return $this->upload($path, $contents, $config);
    }
594773
public function put(string $path, string $contents, array $config = []): bool
    {
        $path = $this->normalizePath($path);
        $config = $this->prepareConfig($config);

        if (! $this->exists($path)) {
            return $this->getAdapter()->update($path, $contents, $config);
        }

        return $this->getAdapter()->write($path, $contents, $config);
    }
1271307
public function put($path, $contents, array $config = [])
    {
        $path = Util::normalizePath($path);
        $config += $this->config;

        if (!$this->adapter->canOverwrite() && $this->has($path)) {
            return (bool) $this->adapter->update($path, $contents, $config);
        }

        return (bool) $this->adapter->write($path, $contents, $config);
    }
13917
public function writeStream($path, $resource, Config $config)
    {
        return $this->upload($path, $resource, $config);
    }
833431
public static function writeFile(string $filename, array $config): bool
    {
        return (bool) file_put_contents(
            static::$root . '/' . $filename,
            Yaml::dump($config)
        );
    }
667976
public function write($path, $contents, Config $config)
    {
        $this->recursiveCreateDir(Util::dirname($path));

        $location = $this->applyPathPrefix($path);
        $stream = $this->share->write($location);

        fwrite($stream, $contents);

        if (!fclose($stream)) {
            return false;
        }

        return compact('path', 'contents');
    }
761223
public function writeStream($path, $resource, Config $config)
    {
        return $this->stream($path, $resource, $config, 'write');
    }
64404
private function putContents($path, $contents)
	{
		file_put_contents($path, $contents);

		// See if we have a .tmpl at the end that we need to remove.
		if (substr($path, -5) == '.tmpl')
		{
			rename($path, substr($path, 0, -5));
			$path = substr($path, 0, -5);
		}

		$info = pathinfo($path);

		// See if we need to do var replacement in actual filename
		if (preg_match("/%=([[:alpha:]_]*)(\+[[:alpha:]]+)?=%/", $info['filename'], $matches) && isset($this->replacements[$matches[1]]))
		{
			$newfile = str_replace($matches[0], $this->replacements[$matches[1]], $info['filename']);

			if (isset($matches[2]))
			{
				$modifier = substr($matches[2], 1);
				switch ($modifier)
				{
					// Upper case word
					case 'uc':
						$value = strtoupper($v);
						break;
					// Upper case first character
					case 'ucf':
						$newfile = ucfirst($newfile);
						break;
					// Upper case first character and plural
					case 'ucfp':
						$newfile = ucfirst(Inflector::pluralize($newfile));
						break;
					// Plural form
					case 'p':
						$newfile = Inflector::pluralize($newfile);
						break;
				}
			}

			rename($path, $info['dirname'] . DS . $newfile . '.' . $info['extension']);

			$path = $info['dirname'] . DS . $newfile . '.' . $info['extension'];
		}

		$this->output->addLine("Creating {$path}", 'success');
	}
399123
public static function write($path, $content)
    {
        if (file_exists($path) && is_file($path) && !is_writable($path)) {
            return new PermissionDeniedException("$path is not writable");
        }

        $directory = dirname($path);

        if (!is_writable($directory)) {
            return new PermissionDeniedException("$directory is not writable");
        }

        file_put_contents($path, $content);
    }
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');

    }
1142559
public function write($path, $contents, \League\Flysystem\Config $config) {
			try {
				$file = $this->bucket->uploadFile($path, $contents);
			} catch (\Exception $e) {
				throw new B2FlysystemException('Error writing file', B2FlysystemException::B2_SDK_ERROR, $e);
			}
			
			return $this->normalizeFileInfo($file);
		}