Convert files into text output in the given format.
This method is copied from qformat_default as a quick fix, as the method there is
protected.
@param array $files
@param int $indent Number of spaces to indent
@return string $string
357585
public function write_files($files, $indent) {
        if (empty($files)) {
            return '';
        }
        $string = '';
        foreach ($files as $file) {
            if ($file->is_directory()) {
                continue;
            }
            $string .= str_repeat('  ', $indent);
            $string .= '<file name="' . $file->get_filename() . '" encoding="base64">';
            $string .= base64_encode($file->get_content());
            $string .= "</file>\n";
        }
        return $string;
    }
677346
public function render($indent = "\t")
    {
        $html = '';
        foreach(self::$storage as $meta) {
            $html .= $indent . $meta->render() . PHP_EOL;
        }
        
        return $html;
    }
699769
protected function renderPayloadDataAsMarkupList(array $data, $indent = 0) {
		$markup = '';
		foreach ($data as $key => $value) {
			$markup .= str_repeat(' ', $indent * 2) . '- ' . $key . ':';
			if (TRUE === is_array($value)) {
				$markup .= $this->renderPayloadDataAsMarkupList($value, ++ $indent);
			} else {
				$markup .= ' ' . $value . PHP_EOL;
			}
		}
		return TRUE === empty($markup) ? '' : PHP_EOL . $markup;
	}
268169
private function doLiteralBlock($value, $indent)
    {
        if ($value === "\n") {
            return '\n';
        }
        if (strpos($value, "\n") === false && strpos($value, "'") === false) {
            return sprintf ("'%s'", $value);
        }
        if (strpos($value, "\n") === false && strpos($value, '"') === false) {
            return sprintf ('"%s"', $value);
        }

        $exploded = explode("\n",$value);
        $newValue = '|';
        $indent  += $this->dumpIndent;
        $spaces   = str_repeat(' ',$indent);

        foreach ($exploded as $line) {
            $newValue .= "\n" . $spaces . $line;
        }

        return $newValue;
    }
1366193
public function setDefaultIndentation($indentation)
	{
		$ind = '';
		for ($i=0; $i < (int) $indentation; $i++)
		{
			$ind .= ' ';
		}
		$this->defaultIndentation = $ind;
	}
965471
public function indent($string, $spaces = 2) {
        $indentation = str_repeat(' ', $spaces);
        $lines = explode("\n", $string);

        foreach ($lines as $index => $line) {
            $lines[$index] = $indentation . $line;
        }

        return implode("\n", $lines);
    }
1071647
public function Render ($indent = 0) {
		$actualGroupItems = & $this->_getScriptsGroupContainer($this->actualGroupName);
		if (count($actualGroupItems) === 0) return '';
		$minify = (bool)self::$globalOptions['jsMinify'];
		$joinTogether = (bool)self::$globalOptions['jsJoin'];
		if ($joinTogether) {
			$result = $this->_renderItemsTogether(
				$this->actualGroupName,
				$actualGroupItems,
				$indent,
				$minify
			);
		} else {
			$result = $this->_renderItemsSeparated(
				$this->actualGroupName,
				$actualGroupItems,
				$indent,
				$minify
			);
		}
		return $result;
	}
624869
protected function indent($offset = 0)
    {

        return $this->isPretty()
            ? str_repeat($this->options['indent_style'], ($this->level + $offset) * $this->options['indent_width'])
            : '';
    }
248019
static function makeOptions (array $options, $indent = '')
  {
    $o = mapAndFilter ($options, function ($v, $k) use ($indent) {
      if (is_object ($v)) {
        if ($v instanceof \RawText)
          return "$k: $v";
        if (method_exists ($v, 'toArray'))
          $v = $v->toArray ();
        else $v = (array)$v;
      }
      return isset ($v)
        ? "$k: " . json_encode ($v, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)
        : null;
    });
    return "{\n$indent  " . implode (",\n$indent  ", $o) . "\n$indent}";
  }
917342
public static function emit($input, $inline = 0, $indent = 0)
	{
		$output = '';
		$prefix = $indent ? \str_repeat(' ', $indent) : '';
        $dumpObjectAsInlineMap = true;

        if ($input instanceof \ArrayObject || $input instanceof \stdClass) {
            $dumpObjectAsInlineMap = empty((array) $input);
        }

        if ($inline <= 0 || (!\is_array($input) && $dumpObjectAsInlineMap) || empty($input)) {
			$output .= $prefix . self::dump($input);
		} else {
			$dumpAsMap = self::isHash($input);

			foreach ($input as $key => $value) {
				if ($inline >= 1 && \is_string($value) && false !== \strpos($value, "\n")) {
					$output .= \sprintf("%s%s%s |\n", $prefix, $dumpAsMap ? self::dump($key) . ':' : '-', '');

					foreach (\preg_split('/\n|\r\n/', $value) as $row) {
						$output .= \sprintf("%s%s%s\n", $prefix, \str_repeat(' ', self::$indentation), $row);
					}

					continue;
				}

                $dumpObjectAsInlineMap = true;

                if ($value instanceof \ArrayObject || $value instanceof \stdClass) {
                    $dumpObjectAsInlineMap = empty((array) $value);
                }

                $willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || empty($value);

				$output .= \sprintf('%s%s%s%s',
						$prefix,
						$dumpAsMap ? self::dump($key) . ':' : '-',
						$willBeInlined ? ' ' : "\n",
						self::emit($value, $inline - 1, $willBeInlined ? 0 : $indent + self::$indentation)
					) . ($willBeInlined ? "\n" : '');
			}
		}

		return $output;
	}
1222905
private function buildIndent($base, $indent, $depth)
    {
        $base = \is_int($base) ? str_repeat(' ', $base) : (string) $base;

        return $depth === 0 ? $base : $base . str_repeat(
            \is_int($indent) ? str_repeat(' ', $indent) : (string) $indent,
            $depth
        );
    }
324247
protected function writeConstantElements($constants, $format = '%s %s\l', $indent = -1)
    {
        $constantString = '';

        foreach ($constants as $name => $value) {
            $line = sprintf($format, '+', $name);
            if ($indent >= 0) {
                $constantString .= $this->formatLine($line, $indent);
            } else {
                $constantString .= $line;
            }
        }
        return $constantString;
    }
1223146
function indent(level) {
    var val = options.indent
    _indent = ''

    if (_lastch === null)
      _lastch = _to                 // as-is, this is the first file
    else if (_lastch !== _to) {
      _lastch = _to
      // istanbul ignore else
      if (output)
        output.emit('data', _to)    // force eol after insert file
    }

    if (level > 0 && val && !/^0+\D?/.test(val)) {
      // format is 2, 2t, 2s, etc. default is spaces
      var match = /^(\d+)\s*(t?)/.exec(val),
          count = level * (match[1] | 0)
      _indent = Array(count + 1).join(match[2] ? '\t' : ' ')
    }
  }
1262734
public function toString($indent = null)
    {
        $helperManager = $this->getView()->getHelperPluginManager();
        if ($helperManager->has('dojo')) {
            $dojo = $helperManager->get('dojo');
            $dojo->initialize();
        }
        return parent::toString($indent);
    }
1349901
public function indentString($str, $spaces)
    {
        if (!$str) {
            return null;
        }

        if ($spaces === 0) {
            return $str;
        }

        $lines = explode("\n", $str);

        foreach ($lines as &$line) {
            $line = sprintf('%\' ' . $spaces . 's%s', '', $line);
        }

        return implode("\n", $lines);
    }
133770
private function _doLiteralBlock($value,$indent)
  {
    if ($value === "\n") return '\n';
    if (strpos($value, "\n") === false && strpos($value, "'") === false) {
      return sprintf ("'%s'", $value);
    }
    if (strpos($value, "\n") === false && strpos($value, '"') === false) {
      return sprintf ('"%s"', $value);
    }
    $exploded = explode("\n",$value);
    $newValue = '|';
    $indent  += $this->_dumpIndent;
    $spaces   = str_repeat(' ',$indent);
    foreach ($exploded as $line) {
      $newValue .= "\n" . $spaces . ($line);
    }

    return $newValue;
  }
1258661
public function extractFiles($outputFolder, array $files)
    {
        $this->sevenZip->setOutputDirectory($outputFolder);
        $count = 0;
        try {

            foreach ($files as $file) {
                $this->sevenZip->extractEntry($file);
                $count++;
            }
            return $count;
        } catch (Exception $e) {
            throw new Exception('Could not extract archive: '.$e->getMessage(), $e->getCode(), $e);
        }
    }