private function wordWrap(string $stringToWrap, int $indent, $maxWidth): string
    {
        $wrapped = $maxWidth === null ? $stringToWrap : wordwrap($stringToWrap, $maxWidth, "\n", true);

        return preg_replace('/\s*[\r\n]\s*/', "\n" . str_repeat(' ', $indent), $wrapped);
    }
private function wordWrap(string $stringToWrap, int $indent, $maxWidth): string
    {
        $wrapped = $maxWidth === null ? $stringToWrap : wordwrap($stringToWrap, $maxWidth, "\n", true);

        return preg_replace('/\s*[\r\n]\s*/', "\n" . str_repeat(' ', $indent), $wrapped);
    }
private function wordWrap ( string $ stringToWrap , int $ indent , $ maxWidth ) : string { $ wrapped = $ maxWidth === null ? $ stringToWrap : wordwrap ( $ stringToWrap , $ maxWidth , "\n" , true ) ; return preg_replace ( '/\s*[\r\n]\s*/' , "\n" . str_repeat ( ' ' , $ indent ) , $ wrapped ) ; }
Wraps a text and adds indentation to new lines

@param string $stringToWrap
@param int $indent
@param int|null $maxWidth
@return string
Wraps a text and adds indentation to new lines