Adds the GAE queue configuration to the 'config/queue.php'
if it does not already exist.

@param string $contents the 'config/queue.php' file contents.
@return string the modified file contents.
434751
protected function addQueueConfig($contents)
    {
        if (str_contains($contents, "'gae'")) {
            return $contents;
        }

        $expression = "/'connections'\s*=>\s*\[/";

        $replacement =
<<<EOT
'connections' => [

        'gae' => [
            'driver'	=> 'gae',
            'queue'		=> 'default',
            'url'		=> '/tasks',
            'encrypt'	=> true,
        ],
EOT;
        $modified = preg_replace($expression, $replacement, $contents);

        if ($contents !== $modified) {
            $this->myCommand->info('Added queue driver configuration in "config/queue.php".');
        }

        return $modified;
    }
1049739
protected function preprocessWindowsPaths($contents)
    {
        $expression = "/'([A-Za-z]:)?((\\\\|\/)[^\\/:*?\"\'<>|\r\n]*)*'/";

        $paths = array();
        preg_match_all($expression, $contents, $paths);

        $modified = $contents;
        foreach ($paths[0] as $path) {
            $normalizedPath = str_replace('\\\\', '/', $path);
            $modified = str_replace($path, $normalizedPath, $modified);
        }

        if ($contents !== $modified) {
            $this->myCommand->info('Preprocessed windows paths in "bootstrap/cache/config.php".');
        }

        return $modified;
    }
1162222
public function write(string $file, string $contents): DirectoryInterface
    {
        $this->filesystem->write("{$this->directory}/{$file}", $contents);

        return $this;
    }
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');
	}
636071
public function write($path, $contents, array $config = [])
    {
        return $this->fileSystem->write($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);
    }
1237154
public function write($path, $contents, array $config = [])
    {
        [$prefix, $path] = $this->getPrefixAndPath($path);

        return $this->getFilesystem($prefix)->write($path, $contents, $config);
    }
1180990
public function addContent($content)
    {
        $freeBufferLength = $this->chunkSize - StringHelper::byteLength($this->_buffer);
        $contentLength = StringHelper::byteLength($content);
        if ($contentLength > $freeBufferLength) {
            $this->_buffer .= StringHelper::byteSubstr($content, 0, $freeBufferLength);
            $this->flushBuffer(true);
            return $this->addContent(StringHelper::byteSubstr($content, $freeBufferLength));
        } else {
            $this->_buffer .= $content;
            $this->flushBuffer();
        }

        return $this;
    }
470298
public function addFromString($localname, $contents)
    {
        if (file_exists($this->filename) && !is_writable($this->filename)) {
            return false;
        }
        return $this->zipArchive->addFromString($localname, $contents);
    }
682088
public function update($path, $contents, Config $config)
    {
        if (! $config->has('visibility') && ! $config->has('ACL')) {
            $config->set(static::$metaMap['ACL'], $this->getObjectACL($path));
        }
        // $this->delete($path);
        return $this->write($path, $contents, $config);
    }
845504
public function save($contents)
	{
		// store the current filename
        $file = $this->file;

        // save it
        $return = parent::save($contents);

        // existing file? saved? and do we need to flush the opcode cache?
        if ($file == $this->file and $return and static::$flush_needed)
        {
			if ($this->file[0] !== '/' and ( ! isset($this->file[1]) or $this->file[1] !== ':'))
			{
				// locate the file
				$file = \Finder::search('config', $this->file, $this->ext);
			}

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

			// flush the opcode caches that are active
			static::$uses_opcache and opcache_invalidate($file, true);
			static::$uses_apc and apc_compile_file($file);
		}

		return $return;
	}
289469
protected function export_format($contents)
	{
		if ( ! function_exists('spyc_load'))
		{
			import('spyc/spyc', 'vendor');
		}

		$this->prep_vars($contents);
		return \Spyc::YAMLDump($contents);
	}
269916
protected function replaceAppClass($contents)
    {
        $modified = str_replace(
            'Illuminate\Foundation\Application',
            'Shpasser\GaeSupportL5\Foundation\Application',
            $contents);

        if ($contents !== $modified) {
            $this->myCommand->info('Replaced the application class in "bootstrap/app.php".');
        }

        return $modified;
    }
363758
public function writeCachedContent($content)
    {
        return $this->smarty->ext->_updateCache->writeCachedContent($this->cached, $this, $content);
    }
36485
public function setContents($key, $contents, $append = false)
    {
        return $this->driver->setContents($key, $contents, $append);
    }
1002801
public function put($path, $contents)
    {
        $this->makeDirectory(dirname($path));

        return file_put_contents($path, $contents);
    }
448881
protected static function parseContents($contents)
    {
        //正文字体
        $fontParameters = $contents[0][1];
        $font = new Font(
            $fontParameters['name'],
            $fontParameters['color'],
            $fontParameters['size'],
            $fontParameters['style']
        );
        unset($contents[0]);
        $contentString = implode('', array_map(function ($content) {
            if ($content && is_array($content) && 'face' === $content[0]) { //处理表情
                $faceText = Content::searchFaceText($content[1]);

                return $faceText ? '['.$faceText.']' : '';
            } else {
                return (string) $content;
            }
        }, $contents));

        return new Content($contentString, $font);
    }