1 | <?php |
||
14 | final class XmlUtils |
||
15 | { |
||
16 | const EXT_NAMESPACE = 'urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2'; |
||
17 | const DS_NAMESPACE = 'http://www.w3.org/2000/09/xmldsig#'; |
||
18 | |||
19 | /** |
||
20 | * @param string $xml |
||
21 | * |
||
22 | * @return string |
||
23 | */ |
||
24 | 8 | public function getHashSign($xml) |
|
25 | { |
||
26 | 8 | $doc = new \DOMDocument(); |
|
27 | 8 | @$doc->loadXML($xml); |
|
|
|||
28 | |||
29 | 8 | return $this->getHashSignFromDoc($doc); |
|
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param string $filename |
||
34 | * |
||
35 | * @return string |
||
36 | */ |
||
37 | 8 | public function getHashSignFromFile($filename) |
|
44 | |||
45 | /** |
||
46 | * @param \DOMDocument $document |
||
47 | * |
||
48 | * @return string |
||
49 | */ |
||
50 | 22 | public function getHashSignFromDoc(\DOMDocument $document) |
|
61 | |||
62 | /** |
||
63 | * @param \DOMDocument $document |
||
64 | * |
||
65 | * @return \DOMXPath |
||
66 | */ |
||
67 | 22 | public function getXpath(\DOMDocument $document) |
|
75 | |||
76 | /** |
||
77 | * @param \DOMNodeList $exts |
||
78 | * @param \DOMXPath $xpt |
||
79 | * @return string |
||
80 | */ |
||
81 | 20 | public function getHash(\DOMNodeList $exts, \DOMXPath $xpt) |
|
96 | } |
||
97 |
If you suppress an error, we recommend checking for the error condition explicitly: