Get indent string
@param string|int $indent
@return string
490587
protected function getIndentString($indent = 0) {
		$indentStr = '';
		if (is_numeric($indent)) {
			$indInt = intval($indent);
			if ($indInt > 0) {
				$i = 0;
				while ($i < $indInt) {
					$indentStr .= "\t";
					$i += 1;
				}
			}
		} else if (is_string($indent)) {
			$indentStr = $indent;
		}
		return $indentStr;
	}
1262734
public function toString($indent = null)
    {
        $helperManager = $this->getView()->getHelperPluginManager();
        if ($helperManager->has('dojo')) {
            $dojo = $helperManager->get('dojo');
            $dojo->initialize();
        }
        return parent::toString($indent);
    }
658218
public function indent( $indent = 4 )
    {
        $indent = $this->generateIndent( $indent );
        foreach( $this->lines as &$line ) {
            $line = $indent . $line;
        }
        return $this;
    }
700318
public function toCustomString( int $subExceptionLevel = 0, string $indentSpaces = '   ' ) : string
   {

      // Concatenate the base error message from usable elements
      $msg = \sprintf(
         '%s%s in %s[%d]. %s',
         \str_repeat( $indentSpaces, $subExceptionLevel ),
         \get_class( $this ),
         $this->file,
         $this->line,
         \str_replace( "\n", "\n" . \str_repeat( $indentSpaces, $subExceptionLevel ), $this->message )
      );

      // getting a may defined previous exception
      $previous = $this->getPrevious();

      // if no previous exception is defined return the current generated message
      if ( null === $previous || ! ( $previous instanceof \Throwable ) )
      {
         return $msg;
      }

      // If previous message is a framework internal exception
      if ( $previous instanceof NiirrtyException )
      {
         // Simple cast the exception to a string and append it with rewrite the indention
         $msg .= "\n" . $previous->toCustomString( $subExceptionLevel + 1, $indentSpaces );
         // And return the message
         return $msg;
      }

      // Else its a normal PHP exception
      // Concatenate the previous error message from usable elements
      $msg .= \sprintf(
         "\n%s%s %s in %s[%d]\n    %s",
         \str_repeat( $indentSpaces, $subExceptionLevel + 1 ),
         \get_class( $previous ),
         static::GetCodeName( $previous->getCode() ),
         $previous->file,
         $previous->line,
         \str_replace( "\n", "\n" . \str_repeat( $indentSpaces, $subExceptionLevel + 1 ), $previous->message )
      );

      // And return the message
      return $msg;

   }
87307
public function render(TableStructure $table, int $indent = 8)
    {
        return str_repeat(' ', $indent)
            . "\$this->createIndex('{$this->name}', '"
            . $table->renderName()
            . "', "
            . (count($this->columns) === 1 ? "'{$this->columns[0]}'" : "['" . implode("', '", $this->columns) . "']")
            . ($this->unique ? ', true' : '')
            . ');';
    }
475133
public function getCode(): string
  {
    $lines       = [];
    $indentLevel = 0;

    foreach ($this->lines as $line)
    {
      $mode = $this->indentationMode($line);

      // Increment or decrement indentation level.
      if ($mode & self::C_INDENT_INCREMENT_BEFORE)
      {
        $indentLevel++;
      }
      if ($mode & self::C_INDENT_DECREMENT_BEFORE)
      {
        $indentLevel = max(0, $indentLevel - 1);
      }
      if ($mode & self::C_INDENT_DECREMENT_BEFORE_DOUBLE)
      {
        $indentLevel = max(0, $indentLevel - 2);
      }

      // If the line is a separator shorten the separator.
      if ($this->separator!==null && $line==$this->separator)
      {
        $line = $this->shortenSeparator($this->width - $this->indentation * $indentLevel);
      }

      // Append the line with indentation.
      $lines[] = $this->addIndentation($line, $indentLevel);

      // Increment or decrement indentation level.
      if ($mode & self::C_INDENT_INCREMENT_AFTER)
      {
        $indentLevel++;
      }
      if ($mode & self::C_INDENT_DECREMENT_AFTER)
      {
        $indentLevel = max(0, $indentLevel - 1);
      }
    }

    if (empty($lines))
    {
      return '';
    }

    return implode(PHP_EOL, $lines).PHP_EOL;
  }
281608
public function indent(int $depth, string $content) : string
    {
        if (!$this->pretty) {
            return $content;
        }

        return PHP_EOL . str_repeat('    ', $this->depth) . $content;
    }
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
        );
    }
580824
public function dump(int $inline = 10, int $indent = 2): string
    {
        return PHP_EOL . Yaml::dump($this->all(), $inline, $indent);
    }
1032478
public function getBaseClassMethods($indent, array &$result)
    {
        $type_getter_name = 'get' . Inflector::classify($this->type_field_name);
        $type_setter_name = 'set' . Inflector::classify($this->type_field_name);

        $id_getter_name = 'get' . Inflector::classify($this->name);
        $id_setter_name = 'set' . Inflector::classify($this->name);

        $instance_getter_name = 'get' . Inflector::classify($this->relation_name);
        $instance_setter_name = 'set' . Inflector::classify($this->relation_name);

        $type_hint = '\\' . ObjectInterface::class;

        $methods = [];

        $methods[] = '/**';
        $methods[] = ' * @param  bool' . str_pad('$use_cache', strlen($type_hint) + 7, ' ', STR_PAD_LEFT);
        $methods[] = ' * @return ' . $type_hint;
        $methods[] = ' */';
        $methods[] = 'public function ' . $instance_getter_name . '($use_cache = true)';
        $methods[] = '{';
        $methods[] = '    if ($id = $this->' . $id_getter_name . '()) {';
        $methods[] = '        return $this->pool->getById($this->' . $type_getter_name . '(), $id, $use_cache);';
        $methods[] = '    } else {';
        $methods[] = '        return null;';
        $methods[] = '    }';
        $methods[] = '}';
        $methods[] = '';

        if ($this->isRequired()) {
            $methods[] = '/**';
            $methods[] = ' * Set ' . $this->relation_name . '.';
            $methods[] = ' *';
            $methods[] = ' * @param  ' . $type_hint . ' $value';
            $methods[] = ' * @return $this';
            $methods[] = ' */';
            $methods[] = 'public function &' . $instance_setter_name . '(\\' . ObjectInterface::class . ' $value)';
            $methods[] = '{';
            $methods[] = '    if ($value instanceof \\' . ObjectInterface::class . ' && $value->isLoaded()) {';
            $methods[] = '        $this->' . $type_setter_name . '(get_class($value));';
            $methods[] = '        $this->' . $id_setter_name . '($value->getId());';
            $methods[] = '    } else {';
            $methods[] = '        throw new \InvalidArgumentException(' . var_export("Instance of '" . ObjectInterface::class . "' expected", true) . ');';
            $methods[] = '    }';
            $methods[] = '';
            $methods[] = '    return $this;';
            $methods[] = '}';
        } else {
            $methods[] = '/**';
            $methods[] = ' * Set ' . $this->relation_name . '.';
            $methods[] = ' *';
            $methods[] = ' * @param  ' . $type_hint . ' $value';
            $methods[] = ' * @return $this';
            $methods[] = ' */';
            $methods[] = 'public function &' . $instance_setter_name . '(\\' . ObjectInterface::class . ' $value = null)';
            $methods[] = '{';
            $methods[] = '    if ($value instanceof \\' . ObjectInterface::class . ') {';
            $methods[] = '        if ($value->isLoaded()) {';
            $methods[] = '            $this->' . $type_setter_name . '(get_class($value));';
            $methods[] = '            $this->' . $id_setter_name . '($value->getId());';
            $methods[] = '        } else {';
            $methods[] = '            throw new \InvalidArgumentException(' . var_export("Instance of '" . ObjectInterface::class . "' expected", true) . ');';
            $methods[] = '        }';
            $methods[] = '    } else {';
            $methods[] = '        $this->' . $type_setter_name . '(null);';
            $methods[] = '        $this->' . $id_setter_name . '(0);';
            $methods[] = '    }';
            $methods[] = '';
            $methods[] = '    return $this;';
            $methods[] = '}';
        }

        foreach ($methods as $line) {
            if ($line) {
                $result[] = "$indent$line";
            } else {
                $result[] = '';
            }
        }
    }
307965
def _get_indent(marker, s, tab_width=8):
    """"""
    # Figure out how much the marker is indented.
    INDENT_CHARS = tuple(' \t')
    start = s.index(marker)
    i = start
    while i > 0:
        if s[i - 1] not in INDENT_CHARS:
            break
        i -= 1
    indent = s[i:start]
    indent_width = 0
    for ch in indent:
        if ch == ' ':
            indent_width += 1
        elif ch == '\t':
            indent_width += tab_width - (indent_width % tab_width)
    return indent, indent_width
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;
    }
617364
public function getIndentation()
    {
        $indentation = $this->getLineIndentation();

        if($this->isFirstTokenOnLine() && $this->matches(T_WHITESPACE)) {
            $indentation = '';
        }

        return $indentation . str_repeat(' ', $this->getStartColumn() - strlen($indentation));
    }
1015873
public function getString($indent = 2, $wordWrap = false)
    {
        $res = $this->driverInstance->getString($indent, $wordWrap);
        if (!$this->isString($res) && !$this->isStringObject($res)) {
            throw new YamlException('YamlInterface method _getString() must return a string or StringObject.');
        }

        return StdObjectWrapper::toString($res);
    }
1236829
def _get_indent(self, node):
        """"""
        lineno = node.lineno
        if lineno > len(self._lines):
            return -1
        wsindent = self._wsregexp.match(self._lines[lineno - 1])
        return len(wsindent.group(1))
141732
public function setIndent(int $indent = 2): self
    {
        if (!Number::Range($indent, 2, 8)) {
            throw new CompilerException(sprintf('"%d" is an invalid indent value', $indent));
        }

        return $this;
    }
1108481
public static function indent(string $strJSON) : string
    {
        $strReturn = "";
        $indentLevel = 0;

        $insideQuotes = false;
        $insideEscape = false;

        $endLineLevel = null;

        $utf8split = preg_split('//u', $strJSON, -1, PREG_SPLIT_NO_EMPTY);
        for ($i = 0; $i < count($utf8split); $i++) {
            $c = $utf8split[$i];
            $newLineLevel = null;
            $post = "";

            if ($endLineLevel !== null) {
                $newLineLevel = $endLineLevel;
                $endLineLevel = null;
            }


            if ($insideEscape === true) {
                $insideEscape = false;
            } elseif ($c === '"') {
                $insideQuotes = !$insideQuotes;
            } elseif ($insideQuotes === false) {
                switch ($c) {
                    case "}":
                    case "]":
                        $indentLevel--;
                        $endLineLevel = null;
                        $newLineLevel = $indentLevel;
                        break;

                    case "{":
                    case "[":
                        $indentLevel++;
                    case ",":
                        $endLineLevel = $indentLevel;
                        break;

                    case ":":
                        $post = " ";
                        break;

                    case " ":
                    case "\t":
                    case "\n":
                    case "\r":
                        $c = "";
                        $endLineLevel = $newLineLevel;
                        $newLineLevel = null;
                        break;
                }
            } elseif ($c === "\\") {
                $insideEscape = true;
            }


            if ($newLineLevel !== null) {
                $strReturn .= "\n" . str_repeat("\t", $newLineLevel);
            }

            $strReturn .= $c . $post;
        }

        return $strReturn;
    }