Format the given line of text.

@param  \Illuminate\Contracts\Support\Htmlable|string|array  $line
@return \Illuminate\Contracts\Support\Htmlable|string
973186
protected function formatLine($line)
    {
        if ($line instanceof Htmlable) {
            return $line;
        }

        if (is_array($line)) {
            return implode(' ', array_map('trim', $line));
        }

        return trim(implode(' ', array_map('trim', preg_split('/\\r\\n|\\r|\\n/', $line))));
    }
772289
protected function parseLine( $line )
	{
		$data	= preg_replace_callback( $this->patterns, array( $this, 'callback' ), $line );
		return unserialize( $data );
	}
202826
public function parseBody( $line )
    {
        $line = rtrim( $line, "\r\n" );
        if ( $this->text === null )
        {
            $this->text = $line;
        }
        else
        {
            $this->text .= "\n" . $line;
        }
    }
300936
private function makeReplacements($line, array $replace)
	{
		foreach ($replace as $key => $value)
		{
			$line = str_replace(':' . $key, $value, $line);
		}

		return $line;
	}
280634
public function setLine($line)
    {
        if ($line === null) {
            return;
        }
        $this->parts = $this->outer::translateCommandline($line);
    }
843943
private function escapeOtherCharactersRegex($line)
    {
        // Match numbers ending on ')' or '.' that are at the beginning of the line.
        $regExs = array('/^[0-9]+(?=\)|\.)/');

        foreach ($regExs as $i)
        {
            if (preg_match($i, $line, $match))
            {
                // Matched an escapable character, adding a backslash on
                // the string before the offending character

                $line = substr_replace($line, '\\', strlen($match[0]), 0);
            }
        }

        return $line;
    }
1127739
private function normalizeChangedLine(string $line): string
    {
        $normalized = substr($line, 1);

        return false === $normalized ? $line : $normalized;
    }
570447
protected function parseHtmlLine( Line$line ):self
	{
		return $this->openNode(new StringNode($this,$line))->appendLine($line->slice(1));
	}
419639
public function parse($line)
    {
        $this->error = false;
        $this->currentTextLineContainer = $this->textLineContainers[$this->config->defaultTextLineContainer];
        $firsttag = clone ($this->currentTextLineContainer->tag);

        $this->str = preg_split($this->currentTextLineContainer->pattern, $line, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
        $this->end = count($this->str);

        if ($this->end > 1) {
            $pos = -1;
            $this->_parse($firsttag, $pos);

            return $firsttag->getContent();
        } else {
            $firsttag->addContentString($line);

            return $firsttag->getContent();
        }
    }
1120010
public function parseLine($line) {
        $line = trim($line, "\r\n");

        if (preg_match('/^([\w-]+):\s+(.+)/', $line, $matches)) {
            $name = strtolower($matches[1]);
            $value = $matches[2];
            $this->currentHeader = $name;

            if (isset($this->headers[$name])) {
                if (!is_array($this->headers[$name])) {
                    $this->headers[$name] = [$this->headers[$name]];
                }
                $this->headers[$name][] = $value;
            }
            else {
                $this->headers[$name] = $value;
            }
        }
        elseif (preg_match('/^\s+(.+)$/', $line, $matches) && $this->currentHeader !== null) {
            if (is_array($this->headers[$this->currentHeader])) {
                $lastKey = sizeof($this->headers[$this->currentHeader]) - 1;
                $this->headers[$this->currentHeader][$lastKey] .= $matches[1];
            }
            else {
                $this->headers[$this->currentHeader] .= $matches[1];
            }
        }

        return $this;
    }
1004951
protected function parseLine( Line$line ):self
	{
		$this->currentLine= $line;
		$this->setLevel($line->getIndentLevel());

		$this->{'parse'.ucfirst($this->getLineType($line))}($line);

		return $this;
	}
1259273
public function parse($line)
    {
        $object = new \stdClass();

        $object->type = 'info';
        $object->message = $line;

        return $object;
    }
764940
private function escapeSpecialCharacters($line)
    {
        $line = $this->escapeFirstCharacters($line);

        $line = $this->escapeOtherCharacters($line);

        return $this->escapeOtherCharactersRegex($line);
    }
423585
protected function convertToArray(&$line)
    {
        $implodeStr = $this->multipleValueSeparator;
        $arr = array_map(
            function ($value, $key) use (&$implodeStr) {
                if (is_array($value) && is_numeric($key)) {
                    $this->convertToArray($value);
                    $implodeStr = '|';
                    return $value;
                }
                return sprintf("%s=%s", $key, $value);
            },
            $line,
            array_keys($line)
        );

        $line = implode(
            $implodeStr, $arr
        );
    }
935566
protected function makeReplacements($line, array $replace)
    {
        foreach ($replace as $key => $value) {
            $line = str_replace(
                [':' . $key, ':' . Str::upper($key), ':' . Str::ucfirst($key)],
                [$value, Str::upper($value), Str::ucfirst($value)],
                $line
            );
        }

        return $line;
    }
75354
public static function format($text) {
		$text = preg_replace_callback('/<b>(.+?)<\/b>/', function($matches) {
			return SS_Cli::text($matches[1], null, null, true);
		}, $text);

		$text = preg_replace_callback('/<success>(.+?)<\/success>/', function($matches) {
			return SS_Cli::text($matches[1], 'green', null, true);
		}, $text);

		$text = preg_replace_callback('/<error>(.+?)<\/error>/', function($matches) {
			return SS_Cli::text($matches[1], 'red', null, true);
		}, $text);

		$text = preg_replace_callback('/<caution>(.+?)<\/caution>/', function($matches) {
			return SS_Cli::text($matches[1], 'yellow', null, true);
		}, $text);

		$text = preg_replace_callback('/<info>(.+?)<\/info>/', function($matches) {
			return SS_Cli::text($matches[1], 'cyan', null, true);
		}, $text);


		return $text;
	}
1322243
public function getOutputLine(int $line): string
    {
        return array_key_exists($line, $this->output) ? $this->output[$line] : null;
    }