Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. HtmlOutputFormatter.php

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\Console

Code

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>';
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal