1 | <?php |
||
24 | class StyleConverter |
||
|
|||
25 | { |
||
26 | /** |
||
27 | * Converts a {@link Style} instance to an {@link OutputFormatterStyle}. |
||
28 | * |
||
29 | * @param Style $style The style to convert. |
||
30 | * |
||
31 | * @return OutputFormatterStyle The converted style. |
||
32 | */ |
||
33 | 259 | public static function convert(Style $style) |
|
34 | { |
||
35 | 259 | $options = array(); |
|
36 | |||
37 | 259 | if ($style->isBold()) { |
|
38 | 237 | $options[] = 'bold'; |
|
39 | } |
||
40 | |||
41 | 259 | if ($style->isBlinking()) { |
|
42 | 1 | $options[] = 'blink'; |
|
43 | } |
||
44 | |||
45 | 259 | if ($style->isUnderlined()) { |
|
46 | 231 | $options[] = 'underscore'; |
|
47 | } |
||
48 | |||
49 | 259 | if ($style->isInverse()) { |
|
50 | 1 | $options[] = 'reverse'; |
|
51 | } |
||
52 | |||
53 | 259 | if ($style->isHidden()) { |
|
54 | 2 | $options[] = 'conceal'; |
|
55 | } |
||
56 | |||
57 | 259 | return new OutputFormatterStyle($style->getForegroundColor(), $style->getBackgroundColor(), $options); |
|
58 | } |
||
59 | |||
60 | private function __construct() |
||
63 | } |
||
64 |