indent

@param int         $level
@param string|null $content

@return  string

@since  3.5
772305
protected function indent(int $level = 0, ?string $content = null): string
    {
        if (!$content) {
            return str_repeat('    ', $level);
        }

        return str_replace("\n", "\n" . str_repeat('    ', $level), $content);
    }
1175617
private function generateIndent( $indent )
    {
        if( is_integer( $indent ) ) {
            $indent = str_repeat( $this->indentChar, $indent );
        } elseif( !is_string($indent) ) {
            throw new BadTypeException( $indent, 'int|string' );
        }
        return $indent;
    }
281608
public function indent(int $depth, string $content) : string
    {
        if (!$this->pretty) {
            return $content;
        }

        return PHP_EOL . str_repeat('    ', $this->depth) . $content;
    }
1262734
public function toString($indent = null)
    {
        $helperManager = $this->getView()->getHelperPluginManager();
        if ($helperManager->has('dojo')) {
            $dojo = $helperManager->get('dojo');
            $dojo->initialize();
        }
        return parent::toString($indent);
    }
677346
public function render($indent = "\t")
    {
        $html = '';
        foreach(self::$storage as $meta) {
            $html .= $indent . $meta->render() . PHP_EOL;
        }
        
        return $html;
    }
692639
protected function getIndentationCharacter(string $content, bool $correctLength = false): string
    {
        if (strpos($content, "\n")) {
            $parts = explode("\n", $content);
            array_shift($parts);
        } else {
            $parts = (array)$content;
        }

        $char = "\t";
        $countTabs = $countSpaces = 0;
        foreach ($parts as $part) {
            $countTabs += substr_count($part, $char);
            $countSpaces += (int)(substr_count($part, ' ') / 4);
        }

        if ($countSpaces > $countTabs) {
            $char = $correctLength ? '    ' : ' ';
        }

        return $char;
    }
245800
function indent(str/*: string*/, level/*: number*/ = 1) /*: string*/ {
    if (typeof str === 'number') [ level, str ] = [ str, level ];
    if (typeof level !== 'number') level = 1;
    return (str || '').replace(/^/gm, '  '.repeat(level));
}
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' : ' ')
    }
  }
383913
private function partial($id, $indent, $level)
    {
        if ($indent !== '') {
            $indentParam = sprintf(self::PARTIAL_INDENT, var_export($indent, true));
        } else {
            $indentParam = '';
        }

        return sprintf(
            $this->prepare(self::PARTIAL, $level),
            var_export($id, true),
            $indentParam
        );
    }
756626
String indent(String s, int level) {
        return Stream.of(s.split("\n"))
                .map(sub -> INDENT_STRING.substring(0, level * INDENT_WIDTH) + sub)
                .collect(Collectors.joining("\n"));
    }
904915
function(sInput, levels, indentString) {
		var indentedLineBreak;

		indentString = indentString || '\t';
		indentedLineBreak = '\n'+ ( new Array( levels + 1 ).join( indentString ) );

		return indentedLineBreak + sInput.split('\n').join(indentedLineBreak);
	}
949110
public static function indent($str, $spaces = 4, $level = 1){
        return str_repeat(" ", $spaces * $level)
            . str_replace("\n", "\n" . str_repeat(" ", $spaces * $level), $str);
    }
875955
protected function renderElement($content = null)
    {
        // Get element parts
        $element    = $this->getElement();
        $attributes = $this->getAttributesAsString();

        // Create html
        $html = '<' . $element;
        if ($attributes) {
            $html .= $attributes;
        }

        // Create closing tag
        if (is_string($content)) {
            $html .= '>' . $content . '</' . $element;
        }
        $html .= $this->getClosingBracket();

        return $html;
    }
959930
public static function escapeAndMarkdown(?string $content): string
    {
        return $content ? C::getMarkdown()->text(Html::escape($content)) : (string) $content;
    }
737652
protected function nodeToString(string $indent = ''): string
    {
        $str = $indent . "--{$this->getName()}--\n";

        foreach ($this->getChildren() as $child)
        {
            $str .= $child->nodeToString($indent . '  ');
        }

        return $str;
    }
1349534
public String format(Comment comment, int indentLevel, CommentLocation commentLocation) {

        // Return if there's nothing to do
        if (comment == null || comment.getContent() == null) {
            return null;
        }

        return format(comment.getContent(), indentLevel, commentLocation);
    }
705053
protected void indent(Appendable app, int indentLevel) throws IOException {
        for (int i=0; i<indentLevel; i++) {
            app.append(' ');
        }
    }