| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3.072 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 4 | public static function extractSignFromDoc(\DOMDocument $document) |
|
| 34 | { |
||
| 35 | 4 | $xpt = new \DOMXPath($document); |
|
| 36 | |||
| 37 | 4 | $exts = $xpt->query('ext:UBLExtensions/ext:UBLExtension', $document->documentElement); |
|
| 38 | 4 | if ($exts->length == 0) { |
|
| 39 | return ''; |
||
| 40 | } |
||
| 41 | 4 | $nodeSign = $exts->item($exts->length - 1); |
|
| 42 | |||
| 43 | 4 | $hash = $xpt->query('ext:ExtensionContent/ds:Signature/ds:SignedInfo/ds:Reference/ds:DigestValue', $nodeSign); |
|
| 44 | |||
| 45 | 4 | if ($hash->length == 0) { |
|
| 46 | return ''; |
||
| 47 | } |
||
| 48 | |||
| 49 | 4 | return $hash->item(0)->nodeValue; |
|
| 50 | } |
||
| 51 | } |