@@ -107,17 +107,20 @@ public function files()
107
107
*
108
108
* $finder->depth('> 1') // the Finder will start matching at level 1.
109
109
* $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point.
110
+ * $finder->depth(['>= 1', '< 3'])
110
111
*
111
- * @param string|int $level The depth level expression
112
+ * @param string|int|string[]|int[] $levels The depth level expression or an array of depth levels
112
113
*
113
114
* @return $this
114
115
*
115
116
* @see DepthRangeFilterIterator
116
117
* @see NumberComparator
117
118
*/
118
- public function depth ($ level )
119
+ public function depth ($ levels )
119
120
{
120
- $ this ->depths [] = new Comparator \NumberComparator ($ level );
121
+ foreach ((array ) $ levels as $ level ) {
122
+ $ this ->depths [] = new Comparator \NumberComparator ($ level );
123
+ }
121
124
122
125
return $ this ;
123
126
}
@@ -131,18 +134,21 @@ public function depth($level)
131
134
* $finder->date('until 2 days ago');
132
135
* $finder->date('> now - 2 hours');
133
136
* $finder->date('>= 2005-10-15');
137
+ * $finder->date(['>= 2005-10-15', '>= 2005-05-27']);
134
138
*
135
- * @param string $date A date range string
139
+ * @param string|string[] $dates A date range string or an array of date ranges
136
140
*
137
141
* @return $this
138
142
*
139
143
* @see strtotime
140
144
* @see DateRangeFilterIterator
141
145
* @see DateComparator
142
146
*/
143
- public function date ($ date )
147
+ public function date ($ dates )
144
148
{
145
- $ this ->dates [] = new Comparator \DateComparator ($ date );
149
+ foreach ((array ) $ dates as $ date ) {
150
+ $ this ->dates [] = new Comparator \DateComparator ($ date );
151
+ }
146
152
147
153
return $ this ;
148
154
}
@@ -155,32 +161,33 @@ public function date($date)
155
161
* $finder->name('*.php')
156
162
* $finder->name('/\.php$/') // same as above
157
163
* $finder->name('test.php')
164
+ * $finder->name(['test.py', 'test.php'])
158
165
*
159
- * @param string $pattern A pattern (a regexp, a glob, or a string)
166
+ * @param string|string[] $patterns A pattern (a regexp, a glob, or a string) or an array of patterns
160
167
*
161
168
* @return $this
162
169
*
163
170
* @see FilenameFilterIterator
164
171
*/
165
- public function name ($ pattern )
172
+ public function name ($ patterns )
166
173
{
167
- $ this ->names [] = $ pattern ;
174
+ $ this ->names = \array_merge ( $ this -> names , ( array ) $ patterns ) ;
168
175
169
176
return $ this ;
170
177
}
171
178
172
179
/**
173
180
* Adds rules that files must not match.
174
181
*
175
- * @param string $pattern A pattern (a regexp, a glob, or a string)
182
+ * @param string|string[] $patterns A pattern (a regexp, a glob, or a string) or an array of patterns
176
183
*
177
184
* @return $this
178
185
*
179
186
* @see FilenameFilterIterator
180
187
*/
181
- public function notName ($ pattern )
188
+ public function notName ($ patterns )
182
189
{
183
- $ this ->notNames [] = $ pattern ;
190
+ $ this ->notNames = \array_merge ( $ this -> notNames , ( array ) $ patterns ) ;
184
191
185
192
return $ this ;
186
193
}
@@ -192,16 +199,17 @@ public function notName($pattern)
192
199
*
193
200
* $finder->contains('Lorem ipsum')
194
201
* $finder->contains('/Lorem ipsum/i')
202
+ * $finder->contains(['dolor', '/ipsum/i'])
195
203
*
196
- * @param string $pattern A pattern (string or regexp)
204
+ * @param string|string[] $patterns A pattern (string or regexp) or an array of patterns
197
205
*
198
206
* @return $this
199
207
*
200
208
* @see FilecontentFilterIterator
201
209
*/
202
- public function contains ($ pattern )
210
+ public function contains ($ patterns )
203
211
{
204
- $ this ->contains [] = $ pattern ;
212
+ $ this ->contains = \array_merge ( $ this -> contains , ( array ) $ patterns ) ;
205
213
206
214
return $ this ;
207
215
}
@@ -213,16 +221,17 @@ public function contains($pattern)
213
221
*
214
222
* $finder->notContains('Lorem ipsum')
215
223
* $finder->notContains('/Lorem ipsum/i')
224
+ * $finder->notContains(['lorem', '/dolor/i'])
216
225
*
217
- * @param string $pattern A pattern (string or regexp)
226
+ * @param string|string[] $patterns A pattern (string or regexp) or an array of patterns
218
227
*
219
228
* @return $this
220
229
*
221
230
* @see FilecontentFilterIterator
222
231
*/
223
- public function notContains ($ pattern )
232
+ public function notContains ($ patterns )
224
233
{
225
- $ this ->notContains [] = $ pattern ;
234
+ $ this ->notContains = \array_merge ( $ this -> notContains , ( array ) $ patterns ) ;
226
235
227
236
return $ this ;
228
237
}
@@ -234,18 +243,19 @@ public function notContains($pattern)
234
243
*
235
244
* $finder->path('some/special/dir')
236
245
* $finder->path('/some\/special\/dir/') // same as above
246
+ * $finder->path(['some dir', 'another/dir'])
237
247
*
238
248
* Use only / as dirname separator.
239
249
*
240
- * @param string $pattern A pattern (a regexp or a string)
250
+ * @param string|string[] $patterns A pattern (a regexp or a string) or an array of patterns
241
251
*
242
252
* @return $this
243
253
*
244
254
* @see FilenameFilterIterator
245
255
*/
246
- public function path ($ pattern )
256
+ public function path ($ patterns )
247
257
{
248
- $ this ->paths [] = $ pattern ;
258
+ $ this ->paths = \array_merge ( $ this -> paths , ( array ) $ patterns ) ;
249
259
250
260
return $ this ;
251
261
}
@@ -257,18 +267,19 @@ public function path($pattern)
257
267
*
258
268
* $finder->notPath('some/special/dir')
259
269
* $finder->notPath('/some\/special\/dir/') // same as above
270
+ * $finder->notPath(['some/file.txt', 'another/file.log'])
260
271
*
261
272
* Use only / as dirname separator.
262
273
*
263
- * @param string $pattern A pattern (a regexp or a string)
274
+ * @param string|string[] $patterns A pattern (a regexp or a string) or an array of patterns
264
275
*
265
276
* @return $this
266
277
*
267
278
* @see FilenameFilterIterator
268
279
*/
269
- public function notPath ($ pattern )
280
+ public function notPath ($ patterns )
270
281
{
271
- $ this ->notPaths [] = $ pattern ;
282
+ $ this ->notPaths = \array_merge ( $ this -> notPaths , ( array ) $ patterns ) ;
272
283
273
284
return $ this ;
274
285
}
@@ -279,17 +290,20 @@ public function notPath($pattern)
279
290
* $finder->size('> 10K');
280
291
* $finder->size('<= 1Ki');
281
292
* $finder->size(4);
293
+ * $finder->size(['> 10K', '< 20K'])
282
294
*
283
- * @param string|int $size A size range string or an integer
295
+ * @param string|int|string[]|int[] $sizes A size range string or an integer or an array of size ranges
284
296
*
285
297
* @return $this
286
298
*
287
299
* @see SizeRangeFilterIterator
288
300
* @see NumberComparator
289
301
*/
290
- public function size ($ size )
302
+ public function size ($ sizes )
291
303
{
292
- $ this ->sizes [] = new Comparator \NumberComparator ($ size );
304
+ foreach ((array ) $ sizes as $ size ) {
305
+ $ this ->sizes [] = new Comparator \NumberComparator ($ size );
306
+ }
293
307
294
308
return $ this ;
295
309
}
0 commit comments