src/Http/Response/Format/JsonOptionalFormatting.php
protected function indentPrettyPrintedJson($jsonString, $indentStyle, $defaultIndentSize = 2)
    {
        $indentChar = $this->getIndentCharForIndentStyle($indentStyle);
        $indentSize = $this->getPrettyPrintIndentSize() ?: $defaultIndentSize;

        // If the given indentation style is allowed to have various indent size
        // (number of chars, that are used to indent one level in each line),
        // indent the JSON string with given (or default) indent size.
        if ($this->hasVariousIndentSize($indentStyle)) {
            return $this->peformIndentation($jsonString, $indentChar, $indentSize);
        }

        // Otherwise following the convention, that indent styles, that does not
        // allowed to have various indent size (e.g. tab) are indented using
        // one tabulation character per one indent level in each line.
        return $this->peformIndentation($jsonString, $indentChar);
    }
protected function indentPrettyPrintedJson($jsonString, $indentStyle, $defaultIndentSize = 2)
    {
        $indentChar = $this->getIndentCharForIndentStyle($indentStyle);
        $indentSize = $this->getPrettyPrintIndentSize() ?: $defaultIndentSize;

        // If the given indentation style is allowed to have various indent size
        // (number of chars, that are used to indent one level in each line),
        // indent the JSON string with given (or default) indent size.
        if ($this->hasVariousIndentSize($indentStyle)) {
            return $this->peformIndentation($jsonString, $indentChar, $indentSize);
        }

        // Otherwise following the convention, that indent styles, that does not
        // allowed to have various indent size (e.g. tab) are indented using
        // one tabulation character per one indent level in each line.
        return $this->peformIndentation($jsonString, $indentChar);
    }
protected function indentPrettyPrintedJson ( $ jsonString , $ indentStyle , $ defaultIndentSize = 2 ) { $ indentChar = $ this -> getIndentCharForIndentStyle ( $ indentStyle ) ; $ indentSize = $ this -> getPrettyPrintIndentSize ( ) ? : $ defaultIndentSize ; // If the given indentation style is allowed to have various indent size // (number of chars, that are used to indent one level in each line), // indent the JSON string with given (or default) indent size. if ( $ this -> hasVariousIndentSize ( $ indentStyle ) ) { return $ this -> peformIndentation ( $ jsonString , $ indentChar , $ indentSize ) ; } // Otherwise following the convention, that indent styles, that does not // allowed to have various indent size (e.g. tab) are indented using // one tabulation character per one indent level in each line. return $ this -> peformIndentation ( $ jsonString , $ indentChar ) ; }
Indent pretty printed JSON string, using given indent style.

@param string $jsonString
@param string $indentStyle
@param int    $defaultIndentSize

@return string
Indent pretty printed JSON string using given indent style .