Conditions | 1 |
Paths | 1 |
Total Lines | 127 |
Code Lines | 83 |
Lines | 0 |
Ratio | 0 % |
Changes | 7 | ||
Bugs | 0 | Features | 3 |
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 |
||
95 | public function getEntityIdsForQueryProvider() { |
||
96 | return [ |
||
97 | [ |
||
98 | new AnyValue(), |
||
99 | new QueryOptions( 10, 0 ), |
||
100 | null, |
||
101 | [], |
||
102 | 0, |
||
103 | 10, |
||
104 | [ [ '_id' => 'Q1' ] ] |
||
105 | ], |
||
106 | [ |
||
107 | new SomeProperty( |
||
108 | new EntityIdValue( new PropertyId( 'P1' ) ), |
||
109 | new ValueDescription( new EntityIdValue( new ItemId( 'Q1' ) ) ) |
||
110 | ), |
||
111 | new QueryOptions( 20, 10 ), |
||
112 | Item::ENTITY_TYPE, |
||
113 | [ 'sclaims.wikibase-entityid' => 'P1-Q1' ], |
||
114 | 10, |
||
115 | 20, |
||
116 | [ [ '_id' => 'Q1' ] ] |
||
117 | ], |
||
118 | [ |
||
119 | new Conjunction( [ |
||
120 | new SomeProperty( |
||
121 | new EntityIdValue( new PropertyId( 'P42' ) ), |
||
122 | new ValueDescription( new StringValue( 'foo' ) ) |
||
123 | ), |
||
124 | new SomeProperty( |
||
125 | new EntityIdValue( new PropertyId( 'P1' ) ), |
||
126 | new ValueDescription( new EntityIdValue( new PropertyId( 'P42' ) ) ) |
||
127 | ) |
||
128 | ] ), |
||
129 | new QueryOptions( 10, 0 ), |
||
130 | Item::ENTITY_TYPE, |
||
131 | [ |
||
132 | '$and' => [ |
||
133 | [ 'sclaims.string' => 'P42-foo' ], |
||
134 | [ 'sclaims.wikibase-entityid' => 'P1-P42' ] |
||
135 | ] |
||
136 | ], |
||
137 | 0, |
||
138 | 10, |
||
139 | [ [ '_id' => 'Q1' ] ] |
||
140 | ], |
||
141 | [ |
||
142 | new Disjunction( [ |
||
143 | new SomeProperty( |
||
144 | new EntityIdValue( new PropertyId( 'P42' ) ), |
||
145 | new ValueDescription( new StringValue( 'foo' ) ) |
||
146 | ), |
||
147 | new SomeProperty( |
||
148 | new EntityIdValue( new PropertyId( 'P1' ) ), |
||
149 | new ValueDescription( new EntityIdValue( new PropertyId( 'P42' ) ) ) |
||
150 | ) |
||
151 | ] ), |
||
152 | new QueryOptions( 10, 0 ), |
||
153 | Item::ENTITY_TYPE, |
||
154 | [ |
||
155 | '$or' => [ |
||
156 | [ 'sclaims.string' => 'P42-foo' ], |
||
157 | [ 'sclaims.wikibase-entityid' => 'P1-P42' ] |
||
158 | ] |
||
159 | ], |
||
160 | 0, |
||
161 | 10, |
||
162 | [ [ '_id' => 'Q1' ] ] |
||
163 | ], |
||
164 | [ |
||
165 | new SomeProperty( |
||
166 | new EntityIdValue( new PropertyId( 'P42' ) ), |
||
167 | new Conjunction( [ |
||
168 | new Disjunction( [ |
||
169 | new ValueDescription( new StringValue( 'foo' ) ) |
||
170 | ] ), |
||
171 | new AnyValue(), |
||
172 | new ValueDescription( new EntityIdValue( new PropertyId( 'P42' ) ) ) |
||
173 | ] ) |
||
174 | ), |
||
175 | new QueryOptions( 10, 0 ), |
||
176 | Item::ENTITY_TYPE, |
||
177 | [ |
||
178 | '$and' => [ |
||
179 | [ |
||
180 | '$or' => [ |
||
181 | [ 'sclaims.string' => 'P42-foo' ] |
||
182 | ] |
||
183 | ], |
||
184 | [], |
||
185 | [ 'sclaims.wikibase-entityid' => 'P42-P42' ] |
||
186 | ] |
||
187 | ], |
||
188 | 0, |
||
189 | 10, |
||
190 | [ [ '_id' => 'Q1' ] ] |
||
191 | ], |
||
192 | [ |
||
193 | new SomeProperty( |
||
194 | new EntityIdValue( new PropertyId( 'P42' ) ), |
||
195 | new ValueDescription( |
||
196 | new TimeValue( '+1952-03-11T00:00:00Z', 0, 0, 0, TimeValue::PRECISION_DAY, 'foo' ) |
||
197 | ) |
||
198 | ), |
||
199 | new QueryOptions( 10, 0 ), |
||
200 | Item::ENTITY_TYPE, |
||
201 | [ 'sclaims.time' => new MongoRegex( '/^P42\-\+1952\-03\-11/' ) ], |
||
202 | 0, |
||
203 | 10, |
||
204 | [ [ '_id' => 'Q1' ] ] |
||
205 | ], |
||
206 | [ |
||
207 | new SomeProperty( |
||
208 | new EntityIdValue( new PropertyId( 'P42' ) ), |
||
209 | new ValueDescription( |
||
210 | new TimeValue( '+1952-00-00T00:00:00Z', 0, 0, 0, TimeValue::PRECISION_YEAR, 'foo' ) |
||
211 | ) |
||
212 | ), |
||
213 | new QueryOptions( 10, 0 ), |
||
214 | Item::ENTITY_TYPE, |
||
215 | [ 'sclaims.time' => new MongoRegex( '/^P42\-\+1952/' ) ], |
||
216 | 0, |
||
217 | 10, |
||
218 | [ [ '_id' => 'Q1' ] ] |
||
219 | ], |
||
220 | ]; |
||
221 | } |
||
222 | |||
340 |