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