Code Duplication    Length = 21-22 lines in 2 locations

Core/Matcher/ContentMatcher.php 2 locations

@@ 268-289 (lines=22) @@
265
     * @return Content[]
266
     * @deprecated
267
     */
268
    protected function findContentsByContentTypeIdentifiers(array $contentTypeIdentifiers)
269
    {
270
        $query = new Query();
271
        $query->limit = self::INT_MAX_16BIT;
272
        if (isset($query->performCount)) $query->performCount = false;
273
        $query->filter = new Query\Criterion\ContentTypeIdentifier($contentTypeIdentifiers);
274
        // sort objects by depth, lower to higher, so that deleting them has less chances of failure
275
        // NB: we only do this in eZP versions that allow depth sorting on content queries
276
        if (class_exists('eZ\Publish\API\Repository\Values\Content\Query\SortClause\LocationDepth')) {
277
            $query->sortClauses = array(new Query\SortClause\LocationDepth(Query::SORT_DESC));
278
        }
279
280
        $results = $this->repository->getSearchService()->findContent($query);
281
282
        $contents = [];
283
        foreach ($results->searchHits as $result) {
284
            // make sure we return every object only once
285
            $contents[$result->valueObject->contentInfo->id] = $result->valueObject;
286
        }
287
288
        return $contents;
289
    }
290
291
    /**
292
     * @param int[] $contentTypeIds
@@ 296-316 (lines=21) @@
293
     * @return Content[]
294
     * @deprecated
295
     */
296
    protected function findContentsByContentTypeIds(array $contentTypeIds)
297
    {
298
        $query = new Query();
299
        $query->limit = self::INT_MAX_16BIT;
300
        if (isset($query->performCount)) $query->performCount = false;
301
        $query->filter = new Query\Criterion\ContentTypeId($contentTypeIds);
302
        // sort objects by depth, lower to higher, so that deleting them has less chances of failure
303
        // NB: we only do this in eZP versions that allow depth sorting on content queries
304
        if (class_exists('eZ\Publish\API\Repository\Values\Content\Query\SortClause\LocationDepth')) {
305
            $query->sortClauses = array(new Query\SortClause\LocationDepth(Query::SORT_DESC));
306
        }
307
        $results = $this->repository->getSearchService()->findContent($query);
308
309
        $contents = [];
310
        foreach ($results->searchHits as $result) {
311
            // make sure we return every object only once
312
            $contents[$result->valueObject->contentInfo->id] = $result->valueObject;
313
        }
314
315
        return $contents;
316
    }
317
318
}
319