indent next output (start tag) or unindent (end tag)

@param string $str indentation
@param bool $output add indendation to output
@return void
765990
function indent($str, $output = true) {
    if ($this->parser->isStartTag) {
      $this->indent .= $str;
      if ($output) {
        $this->out($str, true);
      }
    } else {
      $this->indent = substr($this->indent, 0, -strlen($str));
    }
  }
358176
function flushLinebreaks() {
    if ($this->lineBreaks && !empty($this->output)) {
      $this->out(str_repeat("\n".$this->indent, $this->lineBreaks), true);
    }
    $this->lineBreaks = 0;
  }
520876
protected function _write($str)
    {
        $file = $this->alias->resolve($this->_file);
        if (!is_file($file)) {
            $dir = dirname($file);
            /** @noinspection NotOptimalIfConditionsInspection */
            if (!is_dir($dir) && !@mkdir($dir, 0755, true) && !is_dir($dir)) {
                /** @noinspection ForgottenDebugOutputInspection */
                trigger_error("Unable to create $dir directory: " . error_get_last()['message'], E_USER_WARNING);
            }
        }

        //LOCK_EX flag fight with SWOOLE COROUTINE
        if (file_put_contents($file, $str, FILE_APPEND) === false) {
            /** @noinspection ForgottenDebugOutputInspection */
            trigger_error('Write log to file failed: ' . $file, E_USER_WARNING);
        }
    }
70586
public function write($str, $new_line = true)
    {
        fwrite($this->stream, $str.( true===$new_line ? PHP_EOL : '' ));
        fflush($this->stream);
    }
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' : ' ')
    }
  }
1016936
private function writeLine(string $str)
    {
        $now = time();
        if ($this->file && $this->file_opened < $now - $this->reopen_interval)
        {
            // Close the file after a set interval
            fclose($this->file);
            $this->file = null;
        }

        if (!$this->file)
        {
            touch($this->filename);
            try
            {
                Hook::execute("Wedeto.IO.FileCreated", ['path' => $this->filename]);
            }
            // @codeCoverageIgnoreStart
            // Ignore recursion: if and error occurs in a hook it may end up
            // calling the file writer again, resulting in a loop.
            catch (RecursionException $e)
            {} 
            // @codeCoverageIgnoreEnd


            $this->file = fopen($this->filename, 'a');
            $this->file_opened = time();
        }

        if ($this->file)
            fwrite($this->file, $str . "\n");
    }
370062
function strToUtf8($str)
	{
		$chars = unpack('C*', $str);
		$cnt = \count($chars);
		for($i=1;$i<=$cnt;$i++)
			$this->_charToUtf8($chars[$i]);
		return implode("",$chars);
	}
577884
public function append(string $str, string $mime = "text/html")
    {
        // To append, we need to make sure we have a string first
        if (empty($this->output[$mime]) || !is_string($this->output[$mime]))
            $this->output[$mime] = $this->getOutput($mime);

        $this->output[$mime] .= $str;
        return $this;
    }
613972
public static function highlight_code($str, $show = false)
    {
        if (file_exists($str)) {
            $str = file_get_contents($str);
        }

        $str = stripslashes(trim($str));

        $str = str_replace(array('&lt;', '&gt;'), array('<', '>'), $str);
        $str = str_replace(array('&lt;?php', '?&gt;', '\\'), array('phptagopen', 'phptagclose', 'backslashtmp'), $str);

        $str = '<?php //tempstart' . "\n" . $str . '//tempend ?>'; // <?

        // All the magic happens here, baby!
        $str = highlight_string($str, true);

        if (abs(phpversion()) < 5) {
            $str = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $str);
            $str = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $str);
        }

        // Remove our artificially added PHP
        $str = preg_replace("#\<code\>.+?//tempstart\<br />\</span\>#is", "<code>\n", $str);
        $str = preg_replace("#\<code\>.+?//tempstart\<br />#is", "<code>\n", $str);
        $str = preg_replace("#//tempend.+#is", "</span>\n</code>", $str);

        // Replace our markers back to PHP tags.
        $str    = str_replace(array('phptagopen', 'phptagclose', 'backslashtmp'), array('&lt;?php', '?&gt;', '\\'), $str); //<?
        $line   = explode("<br />", rtrim(ltrim($str, '<code>'), '</code>'));
        $result = '<div class="code"><ol>';
        foreach ($line as $key => $val) {
            $result .= '<li>' . $val . '</li>';
        }

        $result .= '</ol></div>';
        $result = str_replace("\n", "", $result);

        if ($show !== false) {
            echo $result;
        } else {
            return $result;
        }
    }
163975
function indent(str, prefix) {
  prefix = prefix || '   ';
  var lines = str.split("\n");
  lines.forEach(function(line, i) {
    lines[i] = prefix + line;
  });
  return lines.join("\n");
}
1366330
public function writeAll($str)
    {
        if (substr($str, -1) == "\n") {
            $str = substr($str, 0, -1);
        }
        $this->write($str);
        $this->close('in');
        $this->debugStatus();

        return $this;
    }
845977
private function writeLine($text, $indent = 0)
    {
        $indent = strlen($text) + $indent;
        $format = '%'.$indent.'s';

        $this->reference .= sprintf($format, $text).PHP_EOL;
    }
74018
protected static function indent()
    {
        $char = (static::$mode == "html") ? "&nbsp;" : " ";

        for ($i = 0; $i < static::$indent; $i++) {
            for ($y = 0; $y < 4; $y++) {
                echo $char;
            }
        }
    }
1289625
protected static void indent(StringBuilder buffer, int number, String character) {
		for (int i = 0; i < number; ++i) {
			buffer.append(character);
		}
	}
176640
function indent(node) {
  var next = node;
  var i = 0;
  while (next) {
    ++i;
    next = next.suite || next.parent;
  }
  return Array(i).join('  ');
}
164837
private function indent($force = false)
    {
        if ($this->size || $force) {
            $this->result .= $this->break;
        }

        if ($this->size) {
            $this->result .= str_repeat(
                $this->char,
                $this->size * $this->level
            );
        }
    }
817231
public function writeF($str, $args)
    {
        $args = func_get_args();
        if (count($args) < 2) {
            throw new \OutOfBoundsException('Missing argument #2');
        }

        return $this->write(vsprintf(array_shift($args), $args));
    }