Code Duplication    Length = 21-22 lines in 2 locations

Core/Matcher/ContentMatcher.php 2 locations

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