Conditions | 1 |
Paths | 1 |
Total Lines | 70 |
Code Lines | 52 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
78 | public static function columnProvider() : iterable |
||
79 | { |
||
80 | return [ |
||
81 | 'Single quote' => [ |
||
82 | 'single_quote', |
||
83 | "foo'bar", |
||
84 | ], |
||
85 | 'Single quote, doubled' => [ |
||
86 | 'single_quote_doubled', |
||
87 | "foo''bar", |
||
88 | ], |
||
89 | 'Double quote' => [ |
||
90 | 'double_quote', |
||
91 | 'foo"bar', |
||
92 | ], |
||
93 | 'Double quote, doubled' => [ |
||
94 | 'double_quote_doubled', |
||
95 | 'foo""bar', |
||
96 | ], |
||
97 | 'Backspace' => [ |
||
98 | 'backspace', |
||
99 | "foo\x08bar", |
||
100 | ], |
||
101 | 'New line' => [ |
||
102 | 'new_line', |
||
103 | "foo\nbar", |
||
104 | ], |
||
105 | 'Carriage return' => [ |
||
106 | 'carriage_return', |
||
107 | "foo\rbar", |
||
108 | ], |
||
109 | 'Tab' => [ |
||
110 | 'tab', |
||
111 | "foo\tbar", |
||
112 | ], |
||
113 | 'Substitute' => [ |
||
114 | 'substitute', |
||
115 | "foo\x1abar", |
||
116 | ], |
||
117 | 'Backslash' => [ |
||
118 | 'backslash', |
||
119 | 'foo\\bar', |
||
120 | ], |
||
121 | 'Backslash, doubled' => [ |
||
122 | 'backslash_doubled', |
||
123 | 'foo\\\\bar', |
||
124 | ], |
||
125 | 'Percent' => [ |
||
126 | 'percent_sign', |
||
127 | 'foo%bar', |
||
128 | ], |
||
129 | 'Underscore' => [ |
||
130 | 'underscore', |
||
131 | 'foo_bar', |
||
132 | ], |
||
133 | 'NULL string' => [ |
||
134 | 'null_string', |
||
135 | 'NULL', |
||
136 | ], |
||
137 | 'NULL value' => [ |
||
138 | 'null_value', |
||
139 | null, |
||
140 | ], |
||
141 | 'SQL expression' => [ |
||
142 | 'sql_expression', |
||
143 | "'; DROP DATABASE doctrine --", |
||
144 | ], |
||
145 | 'No double conversion' => [ |
||
146 | 'no_double_conversion', |
||
147 | "\\'", |
||
148 | ], |
||
152 |