| Conditions | 5 |
| Paths | 7 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function validate(SamlSignedElement $signedElement, $result) |
||
| 28 | { |
||
| 29 | /** @var \Exception $error */ |
||
| 30 | $errors = []; |
||
| 31 | $success = false; |
||
|
|
|||
| 32 | foreach ($this->xmlSecurityKeyStore as $key) { |
||
| 33 | try { |
||
| 34 | if ($success = $signedElement->validate($key)) { |
||
| 35 | // return on success ... no need to continue |
||
| 36 | return $result; |
||
| 37 | } |
||
| 38 | } catch (\Exception $e) { |
||
| 39 | $errors[] = $e; |
||
| 40 | \Craft::info($e->getMessage(), AbstractPlugin::SAML_CORE_HANDLE); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | if (! empty($errors)) { |
||
| 45 | throw $errors[0]; |
||
| 46 | } |
||
| 47 | |||
| 48 | return $result; |
||
| 49 | } |
||
| 50 | } |
||
| 51 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.