Code Duplication    Length = 21-22 lines in 2 locations

Core/Matcher/ContentMatcher.php 2 locations

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