@@ -38,7 +38,7 @@ |
||
38 | 38 | * @param string $url |
39 | 39 | * @param string $action |
40 | 40 | * @param string $envelope |
41 | - * @param array $parameters |
|
41 | + * @param string[] $parameters |
|
42 | 42 | * @return string |
43 | 43 | * @throws \NFePHP\Common\Exception\SoapException |
44 | 44 | */ |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | curl_setopt($oCurl, CURLOPT_HEADER, 1); |
64 | 64 | curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, 0); |
65 | 65 | curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, 0); |
66 | - if (! $this->disablesec) { |
|
66 | + if (!$this->disablesec) { |
|
67 | 67 | curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, 2); |
68 | 68 | if (is_file($this->casefaz)) { |
69 | 69 | curl_setopt($oCurl, CURLOPT_CAINFO, $this->casefaz); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | curl_setopt($oCurl, CURLOPT_SSLVERSION, $this->soapprotocol); |
73 | - curl_setopt($oCurl, CURLOPT_SSLCERT, $this->tempdir.$this->certfile); |
|
74 | - curl_setopt($oCurl, CURLOPT_SSLKEY, $this->tempdir.$this->prifile); |
|
75 | - if (! empty($this->temppass)) { |
|
73 | + curl_setopt($oCurl, CURLOPT_SSLCERT, $this->tempdir . $this->certfile); |
|
74 | + curl_setopt($oCurl, CURLOPT_SSLKEY, $this->tempdir . $this->prifile); |
|
75 | + if (!empty($this->temppass)) { |
|
76 | 76 | curl_setopt($oCurl, CURLOPT_KEYPASSWD, $this->temppass); |
77 | 77 | } |
78 | 78 | curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, true); |
79 | - if (! empty($envelope)) { |
|
79 | + if (!empty($envelope)) { |
|
80 | 80 | curl_setopt($oCurl, CURLOPT_POST, true); |
81 | 81 | curl_setopt($oCurl, CURLOPT_POSTFIELDS, $envelope); |
82 | 82 | curl_setopt($oCurl, CURLOPT_HTTPHEADER, $parameters); |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | $this->responseBody = trim(substr($response, $headsize)); |
95 | 95 | $this->saveDebugFiles( |
96 | 96 | $operation, |
97 | - $this->requestHead."\n".$this->requestBody, |
|
98 | - $this->responseHead."\n".$this->responseBody |
|
97 | + $this->requestHead . "\n" . $this->requestBody, |
|
98 | + $this->responseHead . "\n" . $this->responseBody |
|
99 | 99 | ); |
100 | 100 | } catch (\Exception $e) { |
101 | 101 | throw SoapException::unableToLoadCurl($e->getMessage()); |
102 | 102 | } |
103 | 103 | if ($this->soaperror != '') { |
104 | - throw SoapException::soapFault($this->soaperror." [$url]"); |
|
104 | + throw SoapException::soapFault($this->soaperror . " [$url]"); |
|
105 | 105 | } |
106 | 106 | if ($httpcode != 200) { |
107 | 107 | throw SoapException::soapFault( |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | if ($this->proxyIP != '') { |
122 | 122 | curl_setopt($oCurl, CURLOPT_HTTPPROXYTUNNEL, 1); |
123 | 123 | curl_setopt($oCurl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); |
124 | - curl_setopt($oCurl, CURLOPT_PROXY, $this->proxyIP.':'.$this->proxyPort); |
|
124 | + curl_setopt($oCurl, CURLOPT_PROXY, $this->proxyIP . ':' . $this->proxyPort); |
|
125 | 125 | if ($this->proxyUser != '') { |
126 | - curl_setopt($oCurl, CURLOPT_PROXYUSERPWD, $this->proxyUser.':'.$this->proxyPass); |
|
126 | + curl_setopt($oCurl, CURLOPT_PROXYUSERPWD, $this->proxyUser . ':' . $this->proxyPass); |
|
127 | 127 | curl_setopt($oCurl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); |
128 | 128 | } |
129 | 129 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $dom->preserveWhiteSpace = false; |
145 | 145 | $dom->loadXML($body); |
146 | 146 | $faultstring = ''; |
147 | - $nodefault = ! empty($dom->getElementsByTagName('faultstring')->item(0)) |
|
147 | + $nodefault = !empty($dom->getElementsByTagName('faultstring')->item(0)) |
|
148 | 148 | ? $dom->getElementsByTagName('faultstring')->item(0) |
149 | 149 | : ''; |
150 | 150 | if (!empty($nodefault)) { |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, 0); |
172 | 172 | curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, 0); |
173 | 173 | curl_setopt($oCurl, CURLOPT_SSLVERSION, $this->soapprotocol); |
174 | - curl_setopt($oCurl, CURLOPT_SSLCERT, $this->tempdir.$this->certfile); |
|
175 | - curl_setopt($oCurl, CURLOPT_SSLKEY, $this->tempdir.$this->prifile); |
|
176 | - if (! empty($this->temppass)) { |
|
174 | + curl_setopt($oCurl, CURLOPT_SSLCERT, $this->tempdir . $this->certfile); |
|
175 | + curl_setopt($oCurl, CURLOPT_SSLKEY, $this->tempdir . $this->prifile); |
|
176 | + if (!empty($this->temppass)) { |
|
177 | 177 | curl_setopt($oCurl, CURLOPT_KEYPASSWD, $this->temppass); |
178 | 178 | } |
179 | 179 | curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, true); |
@@ -171,7 +171,7 @@ |
||
171 | 171 | $this->dom->addChild( |
172 | 172 | $nova, |
173 | 173 | "fimValid", |
174 | - ! empty($this->std->novavalidade->fimvalid) |
|
174 | + !empty($this->std->novavalidade->fimvalid) |
|
175 | 175 | ? $this->std->novavalidade->fimvalid |
176 | 176 | : null, |
177 | 177 | false |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $this->dom->addChild( |
107 | 107 | $ide, |
108 | 108 | "fimValid", |
109 | - ! empty($this->std->fimvalid) ? $this->std->fimvalid : null, |
|
109 | + !empty($this->std->fimvalid) ? $this->std->fimvalid : null, |
|
110 | 110 | false |
111 | 111 | ); |
112 | 112 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $this->dom->addChild( |
182 | 182 | $nova, |
183 | 183 | "fimValid", |
184 | - ! empty($this->std->novavalidade->fimvalid) |
|
184 | + !empty($this->std->novavalidade->fimvalid) |
|
185 | 185 | ? $this->std->novavalidade->fimvalid |
186 | 186 | : null, |
187 | 187 | false |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | } elseif ($this->std->modo == 'ALT') { |
198 | 198 | $node = $this->dom->createElement("alteracao"); |
199 | 199 | $node->appendChild($ide); |
200 | - isset($dados) ? $node->appendChild($dados): null; |
|
201 | - isset($nova) ? $node->appendChild($nova): null; |
|
200 | + isset($dados) ? $node->appendChild($dados) : null; |
|
201 | + isset($nova) ? $node->appendChild($nova) : null; |
|
202 | 202 | } else { |
203 | 203 | $node = $this->dom->createElement("exclusao"); |
204 | 204 | $node->appendChild($ide); |
@@ -137,7 +137,7 @@ |
||
137 | 137 | $this->dom->addChild( |
138 | 138 | $nova, |
139 | 139 | "fimValid", |
140 | - ! empty($this->std->novavalidade->fimvalid) |
|
140 | + !empty($this->std->novavalidade->fimvalid) |
|
141 | 141 | ? $this->std->novavalidade->fimvalid |
142 | 142 | : null, |
143 | 143 | false |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $this->dom->addChild( |
87 | 87 | $idePeriodo, |
88 | 88 | "fimValid", |
89 | - ! empty($this->std->ideperiodo->fimvalid) ? $this->std->ideperiodo->fimvalid : '', |
|
89 | + !empty($this->std->ideperiodo->fimvalid) ? $this->std->ideperiodo->fimvalid : '', |
|
90 | 90 | false |
91 | 91 | ); |
92 | 92 | //infoCadastro |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $this->dom->addChild( |
226 | 226 | $info, |
227 | 227 | "foneFixo", |
228 | - ! empty($cad->fonefixo) ? $cad->fonefixo : '', |
|
228 | + !empty($cad->fonefixo) ? $cad->fonefixo : '', |
|
229 | 229 | false |
230 | 230 | ); |
231 | 231 | $this->dom->addChild( |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | ); |
243 | 243 | $infoCadastro->appendChild($info); |
244 | 244 | } |
245 | - if (isset($this->std->infoop) && !empty($infoCadastro)) { |
|
246 | - $cad = $this->std->infoop; |
|
245 | + if (isset($this->std->infoop) && !empty($infoCadastro)) { |
|
246 | + $cad = $this->std->infoop; |
|
247 | 247 | $infoOP = $this->dom->createElement("infoOP"); |
248 | 248 | $this->dom->addChild( |
249 | 249 | $infoOP, |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | true |
253 | 253 | ); |
254 | 254 | if (isset($this->std->infoefr)) { |
255 | - $cad = $this->std->infoefr; |
|
255 | + $cad = $this->std->infoefr; |
|
256 | 256 | $infoEFR = $this->dom->createElement("infoEFR"); |
257 | 257 | $this->dom->addChild( |
258 | 258 | $infoEFR, |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $infoOP->appendChild($infoEFR); |
270 | 270 | } |
271 | 271 | if (isset($this->std->infoente)) { |
272 | - $cad = $this->std->infoente; |
|
272 | + $cad = $this->std->infoente; |
|
273 | 273 | $infoEnte = $this->dom->createElement("infoEnte"); |
274 | 274 | $this->dom->addChild( |
275 | 275 | $infoEnte, |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | $this->dom->addChild( |
137 | 137 | $exame, |
138 | 138 | "procRealizado", |
139 | - ! empty($exam->procrealizado) ? $exam->procrealizado : null, |
|
139 | + !empty($exam->procrealizado) ? $exam->procrealizado : null, |
|
140 | 140 | false |
141 | 141 | ); |
142 | 142 | $this->dom->addChild( |
143 | 143 | $exame, |
144 | 144 | "obsProc", |
145 | - ! empty($exam->obsproc) ? $exam->obsproc : null, |
|
145 | + !empty($exam->obsproc) ? $exam->obsproc : null, |
|
146 | 146 | false |
147 | 147 | ); |
148 | 148 | $this->dom->addChild( |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | $this->dom->addChild( |
167 | 167 | $exame, |
168 | 168 | "dtFimMonit", |
169 | - ! empty($exam->dtfimmonit) ? $exam->dtfimmonit : null, |
|
169 | + !empty($exam->dtfimmonit) ? $exam->dtfimmonit : null, |
|
170 | 170 | false |
171 | 171 | ); |
172 | 172 | $this->dom->addChild( |
173 | 173 | $exame, |
174 | 174 | "indResult", |
175 | - ! empty($exam->indresult) ? $exam->indresult : null, |
|
175 | + !empty($exam->indresult) ? $exam->indresult : null, |
|
176 | 176 | false |
177 | 177 | ); |
178 | 178 | $aso->appendChild($exame); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $this->dom->addChild( |
195 | 195 | $respMonit, |
196 | 196 | "ufConsClasse", |
197 | - ! empty($this->std->respmonit->ufconsclasse) ? $this->std->respmonit->ufconsclasse : null, |
|
197 | + !empty($this->std->respmonit->ufconsclasse) ? $this->std->respmonit->ufconsclasse : null, |
|
198 | 198 | false |
199 | 199 | ); |
200 | 200 | isset($exame) ? $exame->appendChild($respMonit) : null; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $this->dom->addChild( |
203 | 203 | $ideServSaude, |
204 | 204 | "codCNES", |
205 | - ! empty($this->std->ideservsaude->codcnes) ? $this->std->ideservsaude->codcnes : null, |
|
205 | + !empty($this->std->ideservsaude->codcnes) ? $this->std->ideservsaude->codcnes : null, |
|
206 | 206 | false |
207 | 207 | ); |
208 | 208 | $this->dom->addChild( |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $this->dom->addChild( |
215 | 215 | $ideServSaude, |
216 | 216 | "email", |
217 | - ! empty($this->std->ideservsaude->email) ? $this->std->ideservsaude->email : null, |
|
217 | + !empty($this->std->ideservsaude->email) ? $this->std->ideservsaude->email : null, |
|
218 | 218 | false |
219 | 219 | ); |
220 | 220 | $aso->appendChild($ideServSaude); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function toStd($xml = null) |
59 | 59 | { |
60 | - if (! empty($xml)) { |
|
60 | + if (!empty($xml)) { |
|
61 | 61 | $this->whichIs($xml); |
62 | 62 | } |
63 | 63 | $sxml = simplexml_load_string($this->node); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function whichIs($xml) |
79 | 79 | { |
80 | - if (! Validator::isXML($xml)) { |
|
80 | + if (!Validator::isXML($xml)) { |
|
81 | 81 | throw new InvalidArgumentException( |
82 | 82 | "O argumento passado não é um XML válido." |
83 | 83 | ); |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | $dom->formatOutput = false; |
88 | 88 | $dom->loadXML($xml); |
89 | 89 | foreach ($this->rootTagList as $key) { |
90 | - $node = ! empty($dom->getElementsByTagName($key)->item(0)) |
|
90 | + $node = !empty($dom->getElementsByTagName($key)->item(0)) |
|
91 | 91 | ? $dom->getElementsByTagName($key)->item(0) |
92 | 92 | : ''; |
93 | - if (! empty($node)) { |
|
93 | + if (!empty($node)) { |
|
94 | 94 | $this->node = $dom->saveXML($node); |
95 | 95 | return $key; |
96 | 96 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function toJson($xml = null) |
118 | 118 | { |
119 | - if (! empty($xml)) { |
|
119 | + if (!empty($xml)) { |
|
120 | 120 | $this->toStd($xml); |
121 | 121 | } |
122 | 122 | return $this->json; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function toArray($xml = null) |
131 | 131 | { |
132 | - if (! empty($xml)) { |
|
132 | + if (!empty($xml)) { |
|
133 | 133 | $this->toStd($xml); |
134 | 134 | } |
135 | 135 | return json_decode($this->json, true); |
@@ -123,14 +123,14 @@ |
||
123 | 123 | $orig .= "$p->"; |
124 | 124 | } |
125 | 125 | $exist = false; |
126 | - $test = "\$exist = (!empty(".substr($orig, 0, strlen($orig) - 2).")) ? true : false;"; |
|
126 | + $test = "\$exist = (!empty(" . substr($orig, 0, strlen($orig) - 2) . ")) ? true : false;"; |
|
127 | 127 | eval($test); |
128 | 128 | } |
129 | 129 | $orig .= $name; |
130 | 130 | $resp = null; |
131 | 131 | eval("\$resp = $orig;"); |
132 | 132 | if (!empty($resp) || $resp === 0) { |
133 | - $comm .= $name.'= $resp'; |
|
133 | + $comm .= $name . '= $resp'; |
|
134 | 134 | } else { |
135 | 135 | $comm .= "$name = null"; |
136 | 136 | } |