Code Duplication    Length = 14-16 lines in 3 locations

Core/Matcher/ContentMatcher.php 2 locations

@@ 131-144 (lines=14) @@
128
     * @param int[] $parentLocationIds
129
     * @return Content[]
130
     */
131
    protected function findContentsByParentLocationIds($parentLocationIds)
132
    {
133
        $query = new Query();
134
        $query->limit = PHP_INT_MAX;
135
        $query->filter = new Query\Criterion\ParentLocationId($parentLocationIds);
136
        $results = $this->repository->getSearchService()->findContent($query);
137
138
        $contents = [];
139
        foreach ($results->searchHits as $result) {
140
            $contents[] = $result->valueObject;
141
        }
142
143
        return $contents;
144
    }
145
146
    /**
147
     * @param string[] $remoteParentLocationIds
@@ 166-179 (lines=14) @@
163
     * @param string[] $contentTypeIdentifiers
164
     * @return Content[]
165
     */
166
    protected function findContentsByContentTypeIdentifiers(array $contentTypeIdentifiers)
167
    {
168
        $query = new Query();
169
        $query->limit = PHP_INT_MAX;
170
        $query->filter = new Query\Criterion\ContentTypeIdentifier($contentTypeIdentifiers);
171
        $results = $this->repository->getSearchService()->findContent($query);
172
173
        $contents = [];
174
        foreach ($results->searchHits as $result) {
175
            $contents[] = $result->valueObject;
176
        }
177
178
        return $contents;
179
    }
180
}
181

Core/Matcher/LocationMatcher.php 1 location

@@ 128-143 (lines=16) @@
125
     * @param int[] $parentLocationIds
126
     * @return Location[]
127
     */
128
    protected function findLocationsByParentLocationIds($parentLocationIds)
129
    {
130
        $query = new LocationQuery();
131
        $query->limit = PHP_INT_MAX;
132
        $query->filter = new Query\Criterion\ParentLocationId($parentLocationIds);
133
134
        $results = $this->repository->getSearchService()->findLocations($query);
135
136
        $locations = [];
137
138
        foreach ($results->searchHits as $result) {
139
            $locations[] = $result->valueObject;
140
        }
141
142
        return $locations;
143
    }
144
145
    /**
146
     * @param int[] $parentLocationRemoteIds