Code Duplication    Length = 18-18 lines in 2 locations

Core/Matcher/ContentMatcher.php 2 locations

@@ 203-220 (lines=18) @@
200
     * @param string[] $contentTypeIdentifiers
201
     * @return Content[]
202
     */
203
    protected function findContentsByContentTypeIdentifiers(array $contentTypeIdentifiers)
204
    {
205
        $query = new Query();
206
        $query->limit = PHP_INT_MAX;
207
        $query->filter = new Query\Criterion\ContentTypeIdentifier($contentTypeIdentifiers);
208
        // sort objects by depth, lower to higher, so that deleting them has less chances of failure
209
        /// @todo replace with a location query, as we are using deprecated functionality
210
        $query->sortClauses = array(new Query\SortClause\LocationDepth(Query::SORT_DESC));
211
        $results = $this->repository->getSearchService()->findContent($query);
212
213
        $contents = [];
214
        foreach ($results->searchHits as $result) {
215
            // make sure we return every object only once
216
            $contents[$result->valueObject->contentInfo->id] = $result->valueObject;
217
        }
218
219
        return $contents;
220
    }
221
222
    /**
223
     * @param int[] $contentTypeIds
@@ 226-243 (lines=18) @@
223
     * @param int[] $contentTypeIds
224
     * @return Content[]
225
     */
226
    protected function findContentsByContentTypeIds(array $contentTypeIds)
227
    {
228
        $query = new Query();
229
        $query->limit = PHP_INT_MAX;
230
        $query->filter = new Query\Criterion\ContentTypeId($contentTypeIds);
231
        // sort objects by depth, lower to higher, so that deleting them has less chances of failure
232
        /// @todo replace with a location query, as we are using deprecated functionality
233
        $query->sortClauses = array(new Query\SortClause\LocationDepth(Query::SORT_DESC));
234
        $results = $this->repository->getSearchService()->findContent($query);
235
236
        $contents = [];
237
        foreach ($results->searchHits as $result) {
238
            // make sure we return every object only once
239
            $contents[$result->valueObject->contentInfo->id] = $result->valueObject;
240
        }
241
242
        return $contents;
243
    }
244
}
245