@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | public function __doRequest($request, $location, $action, $version, $oneWay = 0) |
32 | 32 | { |
33 | - $search = [":ns1","ns1:","\n","\r"]; |
|
33 | + $search = [":ns1", "ns1:", "\n", "\r"]; |
|
34 | 34 | return parent::__doRequest( |
35 | 35 | str_replace($search, '', $request), |
36 | 36 | $location, |
@@ -87,7 +87,7 @@ |
||
87 | 87 | */ |
88 | 88 | public function __toString() |
89 | 89 | { |
90 | - $messages = array_map(function (\Exception $exception) { |
|
90 | + $messages = array_map(function(\Exception $exception) { |
|
91 | 91 | return $exception->getMessage(); |
92 | 92 | }, $this->exceptions); |
93 | 93 | return implode(PHP_EOL, $messages); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $dom->formatOutput = false; |
40 | 40 | $dom->loadXML($xml, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG); |
41 | 41 | libxml_clear_errors(); |
42 | - if (! $dom->schemaValidate($xsd)) { |
|
42 | + if (!$dom->schemaValidate($xsd)) { |
|
43 | 43 | $errors = []; |
44 | 44 | foreach (libxml_get_errors() as $error) { |
45 | 45 | $errors[] = $error->message; |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | public function getChave($nodeName = 'infNFe') |
126 | 126 | { |
127 | 127 | $node = $this->getElementsByTagName($nodeName)->item(0); |
128 | - if (! empty($node)) { |
|
128 | + if (!empty($node)) { |
|
129 | 129 | $chaveId = $node->getAttribute("Id"); |
130 | - $chave = preg_replace('/[^0-9]/', '', $chaveId); |
|
130 | + $chave = preg_replace('/[^0-9]/', '', $chaveId); |
|
131 | 131 | return $chave; |
132 | 132 | } |
133 | 133 | return ''; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | public function addArrayChild(DOMElement &$parent, $arr) |
249 | 249 | { |
250 | 250 | $num = 0; |
251 | - if (! empty($arr) && ! empty($parent)) { |
|
251 | + if (!empty($arr) && !empty($parent)) { |
|
252 | 252 | foreach ($arr as $node) { |
253 | 253 | $this->appChild($parent, $node, ''); |
254 | 254 | $num++; |
@@ -194,8 +194,8 @@ |
||
194 | 194 | $mdec = strpos($n[1], '-'); |
195 | 195 | $p = explode('.', $value); |
196 | 196 | |
197 | - $ndec = !empty($p[1]) ? strlen($p[1]) : 0;//decimal digits |
|
198 | - $nint = strlen($p[0]);//integer digits |
|
197 | + $ndec = !empty($p[1]) ? strlen($p[1]) : 0; //decimal digits |
|
198 | + $nint = strlen($p[0]); //integer digits |
|
199 | 199 | if ($nint > $n[0]) { |
200 | 200 | throw new \InvalidArgumentException("O numero é maior que o permitido [$format]."); |
201 | 201 | } |
@@ -20,13 +20,13 @@ |
||
20 | 20 | public static function digestComparisonFailed() |
21 | 21 | { |
22 | 22 | return new static('O conteúdo do XML não corresponde ao Digest Value. ' |
23 | - . 'Provavelmente foi alterado após ter sido assinado'); |
|
23 | + . 'Provavelmente foi alterado após ter sido assinado'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public static function signatureComparisonFailed() |
27 | 27 | { |
28 | 28 | return new static('A assinatura do XML não combina. ' |
29 | - . 'O conteúdo provavelmente foi alterado após ter sido assinado.'); |
|
29 | + . 'O conteúdo provavelmente foi alterado após ter sido assinado.'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 |
@@ -269,7 +269,7 @@ |
||
269 | 269 | . $this->uid() |
270 | 270 | . '/' |
271 | 271 | . $mapto |
272 | - . '/' ; |
|
272 | + . '/'; |
|
273 | 273 | $folderRealPath = sys_get_temp_dir() . $path; |
274 | 274 | } |
275 | 275 | if (substr($folderRealPath, -1) !== '/') { |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | //& isolated, less than, greater than, quotation marks and apostrophes |
84 | 84 | //should be replaced by their html equivalent |
85 | 85 | $input = str_replace( |
86 | - ['&','<','>','"',"'"], |
|
87 | - ['&','<','>','"','''], |
|
86 | + ['&', '<', '>', '"', "'"], |
|
87 | + ['&', '<', '>', '"', '''], |
|
88 | 88 | $input |
89 | 89 | ); |
90 | 90 | $input = self::normalize($input); |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | public static function squashCharacters($input) |
112 | 112 | { |
113 | 113 | $input = trim($input); |
114 | - $aFind = ['á','à','ã','â','é','ê','í','ó','ô','õ','ö','ú','ü', |
|
115 | - 'ç','Á','À','Ã','Â','É','Ê','Í','Ó','Ô','Õ','Ö','Ú','Ü','Ç']; |
|
116 | - $aSubs = ['a','a','a','a','e','e','i','o','o','o','o','u','u', |
|
117 | - 'c','A','A','A','A','E','E','I','O','O','O','O','U','U','C']; |
|
114 | + $aFind = ['á', 'à', 'ã', 'â', 'é', 'ê', 'í', 'ó', 'ô', 'õ', 'ö', 'ú', 'ü', |
|
115 | + 'ç', 'Á', 'À', 'Ã', 'Â', 'É', 'Ê', 'Í', 'Ó', 'Ô', 'Õ', 'Ö', 'Ú', 'Ü', 'Ç']; |
|
116 | + $aSubs = ['a', 'a', 'a', 'a', 'e', 'e', 'i', 'o', 'o', 'o', 'o', 'u', 'u', |
|
117 | + 'c', 'A', 'A', 'A', 'A', 'E', 'E', 'I', 'O', 'O', 'O', 'O', 'U', 'U', 'C']; |
|
118 | 118 | return str_replace($aFind, $aSubs, $input); |
119 | 119 | } |
120 | 120 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | public static function normalize($input) |
129 | 129 | { |
130 | 130 | //Carriage Return, Tab and Line Feed is not acceptable in strings |
131 | - $input = str_replace(["\r","\t","\n"], "", $input); |
|
131 | + $input = str_replace(["\r", "\t", "\n"], "", $input); |
|
132 | 132 | //Multiple spaces is not acceptable in strings |
133 | 133 | $input = preg_replace('/(?:\s\s+)/', ' ', $input); |
134 | 134 | //Only UTF-8 characters is acceptable |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | public static function clearProtocoledXML($string) |
211 | 211 | { |
212 | 212 | $procXML = self::clearXmlString($string); |
213 | - $aApp = array('nfe','cte','mdfe'); |
|
213 | + $aApp = array('nfe', 'cte', 'mdfe'); |
|
214 | 214 | foreach ($aApp as $app) { |
215 | 215 | $procXML = str_replace( |
216 | 216 | 'xmlns="http://www.portalfiscal.inf.br/' . $app . '" xmlns="http://www.w3.org/2000/09/xmldsig#"', |
@@ -229,11 +229,11 @@ discard block |
||
229 | 229 | public static function removeSomeAlienCharsfromTxt($txt) |
230 | 230 | { |
231 | 231 | //remove CRs and TABs |
232 | - $txt = str_replace(["\r","\t"], "", $txt); |
|
232 | + $txt = str_replace(["\r", "\t"], "", $txt); |
|
233 | 233 | //remove multiple spaces |
234 | 234 | $txt = preg_replace('/(?:\s\s+)/', ' ', $txt); |
235 | 235 | //remove spaces at begin and end of fields |
236 | - $txt = str_replace(["| "," |"], "|", $txt); |
|
236 | + $txt = str_replace(["| ", " |"], "|", $txt); |
|
237 | 237 | return $txt; |
238 | 238 | } |
239 | 239 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | class Signer |
34 | 34 | { |
35 | - const CANONICAL = [true,false,null,null]; |
|
35 | + const CANONICAL = [true, false, null, null]; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Make Signature tag |