PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 3.1.0
Defender Security – Malware Scanner, Login Security & Firewall v3.1.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / thecodingmachine / safe / generated / simplexml.php

simplexml.php in Defender Security – Malware Scanner, Login Security & Firewall 3.1.0, at vendor/thecodingmachine/safe/generated/simplexml.php

95 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Safe;
4
5 use Safe\Exceptions\SimplexmlException;
6
7 /**
8 * This function takes a node of a DOM
9 * document and makes it into a SimpleXML node. This new object can
10 * then be used as a native SimpleXML element.
11 *
12 * @param \DOMNode $node A DOM Element node
13 * @param string $class_name You may use this optional parameter so that
14 * simplexml_import_dom will return an object of
15 * the specified class. That class should extend the
16 * SimpleXMLElement class.
17 * @return \SimpleXMLElement Returns a SimpleXMLElement.
18 * @throws SimplexmlException
19 *
20 */
21 function simplexml_import_dom(\DOMNode $node, string $class_name = "SimpleXMLElement"): \SimpleXMLElement
22 {
23 error_clear_last();
24 $result = \simplexml_import_dom($node, $class_name);
25 if ($result === false) {
26 throw SimplexmlException::createFromPhpError();
27 }
28 return $result;
29 }
30
31
32 /**
33 * Convert the well-formed XML document in the given file to an object.
34 *
35 * @param string $filename Path to the XML file
36 *
37 * Libxml 2 unescapes the URI, so if you want to pass e.g.
38 * b&amp;c as the URI parameter a,
39 * you have to call
40 * simplexml_load_file(rawurlencode('http://example.com/?a=' .
41 * urlencode('b&amp;c'))). Since PHP 5.1.0 you don't need to do
42 * this because PHP will do it for you.
43 * @param string $class_name You may use this optional parameter so that
44 * simplexml_load_file will return an object of
45 * the specified class. That class should extend the
46 * SimpleXMLElement class.
47 * @param int $options Since PHP 5.1.0 and Libxml 2.6.0, you may also use the
48 * options parameter to specify additional Libxml parameters.
49 * @param string $ns Namespace prefix or URI.
50 * @param bool $is_prefix TRUE if ns is a prefix, FALSE if it's a URI;
51 * defaults to FALSE.
52 * @return \SimpleXMLElement Returns an object of class SimpleXMLElement with
53 * properties containing the data held within the XML document.
54 * @throws SimplexmlException
55 *
56 */
57 function simplexml_load_file(string $filename, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): \SimpleXMLElement
58 {
59 error_clear_last();
60 $result = \simplexml_load_file($filename, $class_name, $options, $ns, $is_prefix);
61 if ($result === false) {
62 throw SimplexmlException::createFromPhpError();
63 }
64 return $result;
65 }
66
67
68 /**
69 * Takes a well-formed XML string and returns it as an object.
70 *
71 * @param string $data A well-formed XML string
72 * @param string $class_name You may use this optional parameter so that
73 * simplexml_load_string will return an object of
74 * the specified class. That class should extend the
75 * SimpleXMLElement class.
76 * @param int $options Since PHP 5.1.0 and Libxml 2.6.0, you may also use the
77 * options parameter to specify additional Libxml parameters.
78 * @param string $ns Namespace prefix or URI.
79 * @param bool $is_prefix TRUE if ns is a prefix, FALSE if it's a URI;
80 * defaults to FALSE.
81 * @return \SimpleXMLElement Returns an object of class SimpleXMLElement with
82 * properties containing the data held within the xml document.
83 * @throws SimplexmlException
84 *
85 */
86 function simplexml_load_string(string $data, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): \SimpleXMLElement
87 {
88 error_clear_last();
89 $result = \simplexml_load_string($data, $class_name, $options, $ns, $is_prefix);
90 if ($result === false) {
91 throw SimplexmlException::createFromPhpError();
92 }
93 return $result;
94 }
95