function HtmlOutputFormatter::formatHtml
Parameters
array<string|null> $matches:
File
-
vendor/
composer/ composer/ src/ Composer/ Console/ HtmlOutputFormatter.php, line 80
Class
- HtmlOutputFormatter
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\ConsoleCode
private function formatHtml(array $matches) : string {
assert(is_string($matches[1]));
$out = '<span style="';
foreach (explode(';', $matches[1]) as $code) {
if (isset(self::$availableForegroundColors[(int) $code])) {
$out .= 'color:' . self::$availableForegroundColors[(int) $code] . ';';
}
elseif (isset(self::$availableBackgroundColors[(int) $code])) {
$out .= 'background-color:' . self::$availableBackgroundColors[(int) $code] . ';';
}
elseif (isset(self::$availableOptions[(int) $code])) {
switch (self::$availableOptions[(int) $code]) {
case 'bold':
$out .= 'font-weight:bold;';
break;
case 'underscore':
$out .= 'text-decoration:underline;';
break;
}
}
}
return $out . '">' . $matches[2] . '</span>';
}