1 | <?php |
||
23 | class Standardize |
||
24 | { |
||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $node = ''; |
||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $json = ''; |
||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | public $key = ''; |
||
37 | /** |
||
38 | * @var object |
||
39 | */ |
||
40 | private $sxml; |
||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | public $rootTagList = [ |
||
45 | 'distDFeInt', |
||
46 | 'resNFe', |
||
47 | 'resEvento', |
||
48 | 'envEvento', |
||
49 | 'ConsCad', |
||
50 | 'consSitNFe', |
||
51 | 'consReciNFe', |
||
52 | 'downloadNFe', |
||
53 | 'enviNFe', |
||
54 | 'inutNFe', |
||
55 | 'admCscNFCe', |
||
56 | 'consStatServ', |
||
57 | 'retDistDFeInt', |
||
58 | 'retEnvEvento', |
||
59 | 'retConsCad', |
||
60 | 'retConsSitNFe', |
||
61 | 'retConsReciNFe', |
||
62 | 'retDownloadNFe', |
||
63 | 'retEnviNFe', |
||
64 | 'retInutNFe', |
||
65 | 'retAdmCscNFCe', |
||
66 | 'retConsStatServ', |
||
67 | 'procInutNFe', |
||
68 | 'procEventoNFe', |
||
69 | 'procNFe', |
||
70 | 'nfeProc', |
||
71 | 'NFe' |
||
72 | ]; |
||
73 | |||
74 | /** |
||
75 | * Constructor |
||
76 | * @param string $xml |
||
77 | */ |
||
78 | 9 | public function __construct($xml = null) |
|
82 | |||
83 | /** |
||
84 | * Identify node and extract from XML for convertion type |
||
85 | * @param string $xml |
||
86 | * @return string identificated node name |
||
87 | * @throws \InvalidArgumentException |
||
88 | */ |
||
89 | 9 | public function whichIs($xml) |
|
119 | |||
120 | /** |
||
121 | * Returns extract node from XML |
||
122 | * @return string |
||
123 | */ |
||
124 | 1 | public function __toString() |
|
128 | |||
129 | /** |
||
130 | * Returns stdClass converted from xml |
||
131 | * @param string $xml |
||
132 | * @return stdClass |
||
133 | */ |
||
134 | 9 | public function toStd($xml = null) |
|
155 | |||
156 | /** |
||
157 | * Return QRCODE and urlChave from XML |
||
158 | * @return array |
||
159 | */ |
||
160 | private function getQRCode() |
||
173 | |||
174 | /** |
||
175 | * Returns the SimpleXml Object |
||
176 | * @param string $xml |
||
177 | * @return object |
||
178 | */ |
||
179 | public function simpleXml($xml = null) |
||
186 | |||
187 | /** |
||
188 | * Returns JSON string form XML |
||
189 | * @param string $xml |
||
190 | * @return string |
||
191 | */ |
||
192 | 1 | public function toJson($xml = null) |
|
199 | |||
200 | /** |
||
201 | * Returns array from XML |
||
202 | * @param string $xml |
||
203 | * @return array |
||
204 | */ |
||
205 | 1 | public function toArray($xml = null) |
|
212 | } |
||
213 |