Skip to content

Commit be5dfdc

Browse files
authored
Merge pull request #669 from PHPCSStandards/feature/generator-html-static-string-to-constant
Generators/HTML: move static string to class constant
2 parents c774767 + 016c88c commit be5dfdc

File tree

1 file changed

+73
-66
lines changed

1 file changed

+73
-66
lines changed

src/Generators/HTML.php

Lines changed: 73 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,78 @@
2020
class HTML extends Generator
2121
{
2222

23+
/**
24+
* Stylesheet for the HTML output.
25+
*
26+
* @var string
27+
*/
28+
const STYLESHEET = '<style>
29+
body {
30+
background-color: #FFFFFF;
31+
font-size: 14px;
32+
font-family: Arial, Helvetica, sans-serif;
33+
color: #000000;
34+
}
35+
36+
h1 {
37+
color: #666666;
38+
font-size: 20px;
39+
font-weight: bold;
40+
margin-top: 0px;
41+
background-color: #E6E7E8;
42+
padding: 20px;
43+
border: 1px solid #BBBBBB;
44+
}
45+
46+
h2 {
47+
color: #00A5E3;
48+
font-size: 16px;
49+
font-weight: normal;
50+
margin-top: 50px;
51+
}
52+
53+
.code-comparison {
54+
width: 100%;
55+
}
56+
57+
.code-comparison td {
58+
border: 1px solid #CCCCCC;
59+
}
60+
61+
.code-comparison-title, .code-comparison-code {
62+
font-family: Arial, Helvetica, sans-serif;
63+
font-size: 12px;
64+
color: #000000;
65+
vertical-align: top;
66+
padding: 4px;
67+
width: 50%;
68+
background-color: #F1F1F1;
69+
line-height: 15px;
70+
}
71+
72+
.code-comparison-code {
73+
font-family: Courier;
74+
background-color: #F9F9F9;
75+
}
76+
77+
.code-comparison-highlight {
78+
background-color: #DDF1F7;
79+
border: 1px solid #00A5E3;
80+
line-height: 15px;
81+
}
82+
83+
.tag-line {
84+
text-align: center;
85+
width: 100%;
86+
margin-top: 30px;
87+
font-size: 12px;
88+
}
89+
90+
.tag-line a {
91+
color: #000000;
92+
}
93+
</style>';
94+
2395

2496
/**
2597
* Generates the documentation for a standard.
@@ -61,72 +133,7 @@ protected function printHeader()
61133
echo '<html>'.PHP_EOL;
62134
echo ' <head>'.PHP_EOL;
63135
echo " <title>$standard Coding Standards</title>".PHP_EOL;
64-
echo ' <style>
65-
body {
66-
background-color: #FFFFFF;
67-
font-size: 14px;
68-
font-family: Arial, Helvetica, sans-serif;
69-
color: #000000;
70-
}
71-
72-
h1 {
73-
color: #666666;
74-
font-size: 20px;
75-
font-weight: bold;
76-
margin-top: 0px;
77-
background-color: #E6E7E8;
78-
padding: 20px;
79-
border: 1px solid #BBBBBB;
80-
}
81-
82-
h2 {
83-
color: #00A5E3;
84-
font-size: 16px;
85-
font-weight: normal;
86-
margin-top: 50px;
87-
}
88-
89-
.code-comparison {
90-
width: 100%;
91-
}
92-
93-
.code-comparison td {
94-
border: 1px solid #CCCCCC;
95-
}
96-
97-
.code-comparison-title, .code-comparison-code {
98-
font-family: Arial, Helvetica, sans-serif;
99-
font-size: 12px;
100-
color: #000000;
101-
vertical-align: top;
102-
padding: 4px;
103-
width: 50%;
104-
background-color: #F1F1F1;
105-
line-height: 15px;
106-
}
107-
108-
.code-comparison-code {
109-
font-family: Courier;
110-
background-color: #F9F9F9;
111-
}
112-
113-
.code-comparison-highlight {
114-
background-color: #DDF1F7;
115-
border: 1px solid #00A5E3;
116-
line-height: 15px;
117-
}
118-
119-
.tag-line {
120-
text-align: center;
121-
width: 100%;
122-
margin-top: 30px;
123-
font-size: 12px;
124-
}
125-
126-
.tag-line a {
127-
color: #000000;
128-
}
129-
</style>'.PHP_EOL;
136+
echo ' '.self::STYLESHEET.PHP_EOL;
130137
echo ' </head>'.PHP_EOL;
131138
echo ' <body>'.PHP_EOL;
132139
echo " <h1>$standard Coding Standards</h1>".PHP_EOL;

0 commit comments

Comments
 (0)