Conditions | 6 |
Paths | 6 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 19.8497 |
Changes | 0 |
1 | <?php |
||
27 | 2 | public function resolve(CriteriaSet $criteriaSet, array $candidates) |
|
28 | { |
||
29 | 2 | if (false === $criteriaSet->has(IndexCriteria::class)) { |
|
30 | 2 | return $candidates; |
|
31 | } |
||
32 | |||
33 | $result = array(); |
||
34 | /** @var IndexCriteria $indexCriteria */ |
||
35 | foreach ($criteriaSet->get(IndexCriteria::class) as $indexCriteria) { |
||
36 | foreach ($candidates as $endpointReference) { |
||
37 | $endpoint = $endpointReference->getEndpoint(); |
||
38 | if ($endpoint instanceof IndexedEndpoint) { |
||
39 | if ($endpoint->getIndex() == $indexCriteria->getIndex()) { |
||
40 | $result[] = $endpointReference; |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 | |||
46 | return $result; |
||
47 | } |
||
48 | } |
||
49 |