Conditions | 5 |
Paths | 16 |
Total Lines | 84 |
Code Lines | 50 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
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:
If many parameters/temporary variables are present:
1 | <?php |
||
65 | public static function iconSetsProvider(): Generator |
||
66 | { |
||
67 | $coordinate = self::COORDINATE; |
||
68 | $cfvos = <<<XML |
||
69 | <cfvo type="percent" val="0"/> |
||
70 | <cfvo type="percent" val="33"/> |
||
71 | <cfvo type="percent" val="67"/> |
||
72 | XML; |
||
73 | foreach (IconSetValues::cases() as $type) { |
||
74 | yield $type->name => [ |
||
75 | <<<XML |
||
76 | <conditionalFormatting sqref="{$coordinate}"> |
||
77 | <cfRule type="iconSet" priority="1"> |
||
78 | <iconSet iconSet="{$type->value}"> |
||
79 | {$cfvos} |
||
80 | </iconSet> |
||
81 | </cfRule> |
||
82 | </conditionalFormatting> |
||
83 | XML, |
||
84 | $type, |
||
85 | ]; |
||
86 | } |
||
87 | |||
88 | yield 'null' => [ |
||
89 | <<<XML |
||
90 | <conditionalFormatting sqref="{$coordinate}"> |
||
91 | <cfRule type="iconSet" priority="1"> |
||
92 | <iconSet> |
||
93 | {$cfvos} |
||
94 | </iconSet> |
||
95 | </cfRule> |
||
96 | </conditionalFormatting> |
||
97 | XML, |
||
98 | null, |
||
99 | ]; |
||
100 | |||
101 | foreach ([1, 0] as $reverse) { |
||
102 | yield "null/reverse=$reverse" => [ |
||
103 | <<<XML |
||
104 | <conditionalFormatting sqref="{$coordinate}"> |
||
105 | <cfRule type="iconSet" priority="1"> |
||
106 | <iconSet reverse="$reverse"> |
||
107 | {$cfvos} |
||
108 | </iconSet> |
||
109 | </cfRule> |
||
110 | </conditionalFormatting> |
||
111 | XML, |
||
112 | null, |
||
113 | $reverse === 1, |
||
114 | ]; |
||
115 | } |
||
116 | |||
117 | foreach ([1, 0] as $showValue) { |
||
118 | yield "null/showValue=$showValue" => [ |
||
119 | <<<XML |
||
120 | <conditionalFormatting sqref="{$coordinate}"> |
||
121 | <cfRule type="iconSet" priority="1"> |
||
122 | <iconSet showValue="$showValue"> |
||
123 | {$cfvos} |
||
124 | </iconSet> |
||
125 | </cfRule> |
||
126 | </conditionalFormatting> |
||
127 | XML, |
||
128 | null, |
||
129 | null, |
||
130 | $showValue === 1, |
||
131 | ]; |
||
132 | } |
||
133 | |||
134 | foreach ([1, 0] as $custom) { |
||
135 | yield "null/custom=$custom" => [ |
||
136 | <<<XML |
||
137 | <conditionalFormatting sqref="{$coordinate}"> |
||
138 | <cfRule type="iconSet" priority="1"> |
||
139 | <iconSet custom="$custom"> |
||
140 | {$cfvos} |
||
141 | </iconSet> |
||
142 | </cfRule> |
||
143 | </conditionalFormatting> |
||
144 | XML, |
||
145 | null, |
||
146 | null, |
||
147 | null, |
||
148 | $custom === 1, |
||
149 | ]; |
||
153 |