1 | <?php |
||
33 | class HtmlOutputFormatter implements OutputFormatterInterface { |
||
34 | |||
35 | const PATTERN = "/\[(([\d+];?)*)m(.*?)\[(([\d+];?)*)m/i"; |
||
36 | |||
37 | static private $styles = [ |
||
38 | '30' => 'color:rgba(0,0,0,1)', |
||
39 | '31' => 'color:rgba(230,50,50,1)', |
||
40 | '32' => 'color:rgba(50,230,50,1)', |
||
41 | '33' => 'color:rgba(230,230,50,1)', |
||
42 | '34' => 'color:rgba(50,50,230,1)', |
||
43 | '35' => 'color:rgba(230,50,150,1)', |
||
44 | '36' => 'color:rgba(50,230,230,1)', |
||
45 | '37' => 'color:rgba(250,250,250,1)', |
||
46 | '40' => 'color:rgba(0,0,0,1)', |
||
47 | '41' => 'background-color:rgba(230,50,50,1)', |
||
48 | '42' => 'background-color:rgba(50,230,50,1)', |
||
49 | '43' => 'background-color:rgba(230,230,50,1)', |
||
50 | '44' => 'background-color:rgba(50,50,230,1)', |
||
51 | '45' => 'background-color:rgba(230,50,150,1)', |
||
52 | '46' => 'background-color:rgba(50,230,230,1)', |
||
53 | '47' => 'background-color:rgba(250,250,250,1)', |
||
54 | '1' => 'font-weight:bold', |
||
55 | '4' => 'text-decoration:underline', |
||
56 | '8' => 'visibility:hidden', |
||
57 | ]; |
||
58 | private $formatter; |
||
59 | |||
60 | /** |
||
61 | * HtmlOutputFormatter constructor. |
||
62 | * |
||
63 | * @param $formatter |
||
64 | */ |
||
65 | public function __construct($formatter){ |
||
68 | |||
69 | /** |
||
70 | * @param bool $decorated |
||
71 | * @return mixed |
||
72 | */ |
||
73 | public function setDecorated($decorated){ |
||
76 | |||
77 | /** |
||
78 | * @return mixed |
||
79 | */ |
||
80 | public function isDecorated(){ |
||
83 | |||
84 | /** |
||
85 | * @param string $name |
||
86 | * @param OutputFormatterStyleInterface $style |
||
87 | * @return mixed |
||
88 | */ |
||
89 | public function setStyle($name, OutputFormatterStyleInterface $style){ |
||
92 | |||
93 | /** |
||
94 | * @param string $name |
||
95 | * @return mixed |
||
96 | */ |
||
97 | public function hasStyle($name){ |
||
100 | |||
101 | /** |
||
102 | * @param string $name |
||
103 | * @return mixed |
||
104 | */ |
||
105 | public function getStyle($name){ |
||
108 | |||
109 | /** |
||
110 | * @param string $message |
||
111 | * @return mixed |
||
112 | */ |
||
113 | public function format($message){ |
||
120 | |||
121 | /** |
||
122 | * @param $matches |
||
123 | * @return string |
||
124 | */ |
||
125 | protected function replaceFormat($matches){ |
||
138 | |||
139 | } |
||
140 |