Conditions | 8 |
Paths | 5 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 29.9519 |
Changes | 0 |
1 | <?php |
||
26 | 10 | public function resolve(CriteriaSet $criteriaSet, array $arrCredentials = array()) |
|
27 | { |
||
28 | 10 | if (false == $criteriaSet->has(AlgorithmCriteria::class)) { |
|
|
|||
29 | 10 | return $arrCredentials; |
|
30 | } |
||
31 | |||
32 | $result = array(); |
||
33 | foreach ($criteriaSet->get(AlgorithmCriteria::class) as $criteria) { |
||
34 | /* @var AlgorithmCriteria $criteria */ |
||
35 | foreach ($arrCredentials as $credential) { |
||
36 | if (($credential->getPrivateKey() && $credential->getPrivateKey()->getAlgorith() == $criteria->getAlgorithm()) || |
||
37 | ($credential->getPublicKey() && $credential->getPublicKey()->getAlgorith() == $criteria->getAlgorithm()) |
||
38 | ) { |
||
39 | $result[] = $credential; |
||
40 | } |
||
41 | } |
||
42 | } |
||
43 | |||
44 | return $result; |
||
45 | } |
||
46 | } |
||
47 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.