Completed
Push — master ( 8e7dca...6ec0d0 )
by frank
01:41
created

Colors::getNamedToHexMap()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 109

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 109
rs 8
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Autoptimize\tubalmartin\CssMin;
4
5
class Colors
6
{
7
    public static function getHexToNamedMap()
8
    {
9
        // Hex colors longer than named counterpart
10
        return array(
11
            '#f0ffff' => 'azure',
12
            '#f5f5dc' => 'beige',
13
            '#ffe4c4' => 'bisque',
14
            '#a52a2a' => 'brown',
15
            '#ff7f50' => 'coral',
16
            '#ffd700' => 'gold',
17
            '#808080' => 'gray',
18
            '#008000' => 'green',
19
            '#4b0082' => 'indigo',
20
            '#fffff0' => 'ivory',
21
            '#f0e68c' => 'khaki',
22
            '#faf0e6' => 'linen',
23
            '#800000' => 'maroon',
24
            '#000080' => 'navy',
25
            '#fdf5e6' => 'oldlace',
26
            '#808000' => 'olive',
27
            '#ffa500' => 'orange',
28
            '#da70d6' => 'orchid',
29
            '#cd853f' => 'peru',
30
            '#ffc0cb' => 'pink',
31
            '#dda0dd' => 'plum',
32
            '#800080' => 'purple',
33
            '#f00'    => 'red',
34
            '#fa8072' => 'salmon',
35
            '#a0522d' => 'sienna',
36
            '#c0c0c0' => 'silver',
37
            '#fffafa' => 'snow',
38
            '#d2b48c' => 'tan',
39
            '#008080' => 'teal',
40
            '#ff6347' => 'tomato',
41
            '#ee82ee' => 'violet',
42
            '#f5deb3' => 'wheat'
43
        );
44
    }
45
46
    public static function getNamedToHexMap()
47
    {
48
        // Named colors longer than hex counterpart
49
        return array(
50
            'aliceblue' => '#f0f8ff',
51
            'antiquewhite' => '#faebd7',
52
            'aquamarine' => '#7fffd4',
53
            'black' => '#000',
54
            'blanchedalmond' => '#ffebcd',
55
            'blueviolet' => '#8a2be2',
56
            'burlywood' => '#deb887',
57
            'cadetblue' => '#5f9ea0',
58
            'chartreuse' => '#7fff00',
59
            'chocolate' => '#d2691e',
60
            'cornflowerblue' => '#6495ed',
61
            'cornsilk' => '#fff8dc',
62
            'darkblue' => '#00008b',
63
            'darkcyan' => '#008b8b',
64
            'darkgoldenrod' => '#b8860b',
65
            'darkgray' => '#a9a9a9',
66
            'darkgreen' => '#006400',
67
            'darkgrey' => '#a9a9a9',
68
            'darkkhaki' => '#bdb76b',
69
            'darkmagenta' => '#8b008b',
70
            'darkolivegreen' => '#556b2f',
71
            'darkorange' => '#ff8c00',
72
            'darkorchid' => '#9932cc',
73
            'darksalmon' => '#e9967a',
74
            'darkseagreen' => '#8fbc8f',
75
            'darkslateblue' => '#483d8b',
76
            'darkslategray' => '#2f4f4f',
77
            'darkslategrey' => '#2f4f4f',
78
            'darkturquoise' => '#00ced1',
79
            'darkviolet' => '#9400d3',
80
            'deeppink' => '#ff1493',
81
            'deepskyblue' => '#00bfff',
82
            'dodgerblue' => '#1e90ff',
83
            'firebrick' => '#b22222',
84
            'floralwhite' => '#fffaf0',
85
            'forestgreen' => '#228b22',
86
            'fuchsia' => '#f0f',
87
            'gainsboro' => '#dcdcdc',
88
            'ghostwhite' => '#f8f8ff',
89
            'goldenrod' => '#daa520',
90
            'greenyellow' => '#adff2f',
91
            'honeydew' => '#f0fff0',
92
            'indianred' => '#cd5c5c',
93
            'lavender' => '#e6e6fa',
94
            'lavenderblush' => '#fff0f5',
95
            'lawngreen' => '#7cfc00',
96
            'lemonchiffon' => '#fffacd',
97
            'lightblue' => '#add8e6',
98
            'lightcoral' => '#f08080',
99
            'lightcyan' => '#e0ffff',
100
            'lightgoldenrodyellow' => '#fafad2',
101
            'lightgray' => '#d3d3d3',
102
            'lightgreen' => '#90ee90',
103
            'lightgrey' => '#d3d3d3',
104
            'lightpink' => '#ffb6c1',
105
            'lightsalmon' => '#ffa07a',
106
            'lightseagreen' => '#20b2aa',
107
            'lightskyblue' => '#87cefa',
108
            'lightslategray' => '#778899',
109
            'lightslategrey' => '#778899',
110
            'lightsteelblue' => '#b0c4de',
111
            'lightyellow' => '#ffffe0',
112
            'limegreen' => '#32cd32',
113
            'mediumaquamarine' => '#66cdaa',
114
            'mediumblue' => '#0000cd',
115
            'mediumorchid' => '#ba55d3',
116
            'mediumpurple' => '#9370db',
117
            'mediumseagreen' => '#3cb371',
118
            'mediumslateblue' => '#7b68ee',
119
            'mediumspringgreen' => '#00fa9a',
120
            'mediumturquoise' => '#48d1cc',
121
            'mediumvioletred' => '#c71585',
122
            'midnightblue' => '#191970',
123
            'mintcream' => '#f5fffa',
124
            'mistyrose' => '#ffe4e1',
125
            'moccasin' => '#ffe4b5',
126
            'navajowhite' => '#ffdead',
127
            'olivedrab' => '#6b8e23',
128
            'orangered' => '#ff4500',
129
            'palegoldenrod' => '#eee8aa',
130
            'palegreen' => '#98fb98',
131
            'paleturquoise' => '#afeeee',
132
            'palevioletred' => '#db7093',
133
            'papayawhip' => '#ffefd5',
134
            'peachpuff' => '#ffdab9',
135
            'powderblue' => '#b0e0e6',
136
            'rebeccapurple' => '#663399',
137
            'rosybrown' => '#bc8f8f',
138
            'royalblue' => '#4169e1',
139
            'saddlebrown' => '#8b4513',
140
            'sandybrown' => '#f4a460',
141
            'seagreen' => '#2e8b57',
142
            'seashell' => '#fff5ee',
143
            'slateblue' => '#6a5acd',
144
            'slategray' => '#708090',
145
            'slategrey' => '#708090',
146
            'springgreen' => '#00ff7f',
147
            'steelblue' => '#4682b4',
148
            'turquoise' => '#40e0d0',
149
            'white' => '#fff',
150
            'whitesmoke' => '#f5f5f5',
151
            'yellow' => '#ff0',
152
            'yellowgreen' => '#9acd32'
153
        );
154
    }
155
}
156