Conditions | 1 |
Paths | 1 |
Total Lines | 177 |
Code Lines | 89 |
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 |
||
50 | public function providerOperator(): array |
||
51 | { |
||
52 | return [ |
||
53 | [ |
||
54 | 'alias.field BETWEEN :filter1 AND :filter2', |
||
55 | BetweenOperatorType::class, |
||
56 | [ |
||
57 | 'from' => 123, |
||
58 | 'to' => 456, |
||
59 | 'not' => false, |
||
60 | ], |
||
61 | ], |
||
62 | [ |
||
63 | 'alias.field NOT BETWEEN :filter1 AND :filter2', |
||
64 | BetweenOperatorType::class, |
||
65 | [ |
||
66 | 'from' => 123, |
||
67 | 'to' => 456, |
||
68 | 'not' => true, |
||
69 | ], |
||
70 | ], |
||
71 | [ |
||
72 | ':filter1 MEMBER OF alias.field', |
||
73 | ContainOperatorType::class, |
||
74 | [ |
||
75 | 'values' => [123, 456], |
||
76 | 'not' => false, |
||
77 | ], |
||
78 | ], |
||
79 | [ |
||
80 | ':filter1 NOT MEMBER OF alias.field', |
||
81 | ContainOperatorType::class, |
||
82 | [ |
||
83 | 'values' => [123, 456], |
||
84 | 'not' => true, |
||
85 | ], |
||
86 | ], |
||
87 | [ |
||
88 | 'alias.field IS EMPTY', |
||
89 | EmptyOperatorType::class, |
||
90 | [ |
||
91 | 'not' => false, |
||
92 | ], |
||
93 | ], |
||
94 | [ |
||
95 | 'alias.field IS NOT EMPTY', |
||
96 | EmptyOperatorType::class, |
||
97 | [ |
||
98 | 'not' => true, |
||
99 | ], |
||
100 | ], |
||
101 | [ |
||
102 | 'alias.field = :filter1', |
||
103 | EqualOperatorType::class, |
||
104 | [ |
||
105 | 'value' => 123, |
||
106 | 'not' => false, |
||
107 | ], |
||
108 | ], |
||
109 | [ |
||
110 | 'alias.field != :filter1', |
||
111 | EqualOperatorType::class, |
||
112 | [ |
||
113 | 'value' => 123, |
||
114 | 'not' => true, |
||
115 | ], |
||
116 | ], |
||
117 | [ |
||
118 | 'alias.field > :filter1', |
||
119 | GreaterOperatorType::class, |
||
120 | [ |
||
121 | 'value' => 123, |
||
122 | 'not' => false, |
||
123 | ], |
||
124 | ], |
||
125 | [ |
||
126 | 'alias.field <= :filter1', |
||
127 | GreaterOperatorType::class, |
||
128 | [ |
||
129 | 'value' => 123, |
||
130 | 'not' => true, |
||
131 | ], |
||
132 | ], |
||
133 | [ |
||
134 | 'alias.field >= :filter1', |
||
135 | GreaterOrEqualOperatorType::class, |
||
136 | [ |
||
137 | 'value' => 123, |
||
138 | 'not' => false, |
||
139 | ], |
||
140 | ], |
||
141 | [ |
||
142 | 'alias.field < :filter1', |
||
143 | GreaterOrEqualOperatorType::class, |
||
144 | [ |
||
145 | 'value' => 123, |
||
146 | 'not' => true, |
||
147 | ], |
||
148 | ], |
||
149 | [ |
||
150 | 'alias.field IN (:filter1)', |
||
151 | InOperatorType::class, |
||
152 | [ |
||
153 | 'values' => [123, 456], |
||
154 | 'not' => false, |
||
155 | ], |
||
156 | ], |
||
157 | [ |
||
158 | 'alias.field NOT IN (:filter1)', |
||
159 | InOperatorType::class, |
||
160 | [ |
||
161 | 'values' => [123, 456], |
||
162 | 'not' => true, |
||
163 | ], |
||
164 | ], |
||
165 | [ |
||
166 | 'alias.field < :filter1', |
||
167 | LessOperatorType::class, |
||
168 | [ |
||
169 | 'value' => 123, |
||
170 | 'not' => false, |
||
171 | ], |
||
172 | ], |
||
173 | [ |
||
174 | 'alias.field >= :filter1', |
||
175 | LessOperatorType::class, |
||
176 | [ |
||
177 | 'value' => 123, |
||
178 | 'not' => true, |
||
179 | ], |
||
180 | ], |
||
181 | [ |
||
182 | 'alias.field <= :filter1', |
||
183 | LessOrEqualOperatorType::class, |
||
184 | [ |
||
185 | 'value' => 123, |
||
186 | 'not' => false, |
||
187 | ], |
||
188 | ], |
||
189 | [ |
||
190 | 'alias.field > :filter1', |
||
191 | LessOrEqualOperatorType::class, |
||
192 | [ |
||
193 | 'value' => 123, |
||
194 | 'not' => true, |
||
195 | ], |
||
196 | ], |
||
197 | [ |
||
198 | 'alias.field LIKE :filter1', |
||
199 | LikeOperatorType::class, |
||
200 | [ |
||
201 | 'value' => 123, |
||
202 | 'not' => false, |
||
203 | ], |
||
204 | ], |
||
205 | [ |
||
206 | 'alias.field NOT LIKE :filter1', |
||
207 | LikeOperatorType::class, |
||
208 | [ |
||
209 | 'value' => 123, |
||
210 | 'not' => true, |
||
211 | ], |
||
212 | ], |
||
213 | [ |
||
214 | 'alias.field IS NULL', |
||
215 | NullOperatorType::class, |
||
216 | [ |
||
217 | 'value' => 123, |
||
218 | 'not' => false, |
||
219 | ], |
||
220 | ], |
||
221 | [ |
||
222 | 'alias.field IS NOT NULL', |
||
223 | NullOperatorType::class, |
||
224 | [ |
||
225 | 'value' => 123, |
||
226 | 'not' => true, |
||
227 | ], |
||
232 |