Code Duplication    Length = 11-12 lines in 3 locations

src/OptimizedPathMappingRepository.php 2 locations

@@ 257-267 (lines=11) @@
254
     *
255
     * @return RegexFilterIterator The iterator of paths.
256
     */
257
    private function getChildIterator(PuliResource $resource)
258
    {
259
        $staticPrefix = rtrim($resource->getPath(), '/').'/';
260
        $regExp = '~^'.preg_quote($staticPrefix, '~').'[^/]+$~';
261
262
        return new RegexFilterIterator(
263
            $regExp,
264
            $staticPrefix,
265
            new ArrayIterator($this->store->keys())
266
        );
267
    }
268
269
    /**
270
     * Returns a recursive iterator for the children paths under a given path.
@@ 276-286 (lines=11) @@
273
     *
274
     * @return RegexFilterIterator The iterator of paths.
275
     */
276
    private function getRecursivePathChildIterator($path)
277
    {
278
        $staticPrefix = rtrim($path, '/').'/';
279
        $regExp = '~^'.preg_quote($staticPrefix, '~').'.+$~';
280
281
        return new RegexFilterIterator(
282
            $regExp,
283
            $staticPrefix,
284
            new ArrayIterator($this->store->keys())
285
        );
286
    }
287
288
    /**
289
     * Returns an iterator for a glob.

src/InMemoryRepository.php 1 location

@@ 327-338 (lines=12) @@
324
     *
325
     * @return RegexFilterIterator The iterator.
326
     */
327
    private function getChildIterator(PuliResource $resource)
328
    {
329
        $staticPrefix = rtrim($resource->getPath(), '/').'/';
330
        $regExp = '~^'.preg_quote($staticPrefix, '~').'[^/]+$~';
331
332
        return new RegexFilterIterator(
333
            $regExp,
334
            $staticPrefix,
335
            new ArrayIterator($this->resources),
336
            RegexFilterIterator::FILTER_KEY
337
        );
338
    }
339
340
    /**
341
     * Returns an iterator for a glob.