@@ -109,15 +109,15 @@ |
||
109 | 109 | if (substr($linha, 0, 2) == 'A|') { |
110 | 110 | $resp[$xCount]['init'] = $iCount; |
111 | 111 | if ($xCount > 0) { |
112 | - $resp[$xCount -1]['fim'] = $iCount; |
|
112 | + $resp[$xCount - 1]['fim'] = $iCount; |
|
113 | 113 | } |
114 | 114 | $xCount += 1; |
115 | 115 | } |
116 | 116 | $iCount += 1; |
117 | 117 | } |
118 | - $resp[$xCount-1]['fim'] = $iCount; |
|
118 | + $resp[$xCount - 1]['fim'] = $iCount; |
|
119 | 119 | foreach ($resp as $marc) { |
120 | - $length = $marc['fim']-$marc['init']; |
|
120 | + $length = $marc['fim'] - $marc['init']; |
|
121 | 121 | $aNotas[] = array_slice($array, $marc['init'], $length, false); |
122 | 122 | } |
123 | 123 | return $aNotas; |
@@ -75,7 +75,7 @@ |
||
75 | 75 | $cNF |
76 | 76 | ); |
77 | 77 | $ide->getElementsByTagName('cDV')->item(0)->nodeValue = substr($chave, -1); |
78 | - $infNFe->setAttribute('Id', 'NFe'.$chave); |
|
78 | + $infNFe->setAttribute('Id', 'NFe' . $chave); |
|
79 | 79 | return Strings::clearXmlString($dom->saveXML(), true); |
80 | 80 | } |
81 | 81 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | $html .= '<h2>body</h2>'; |
67 | 67 | $html .= str_replace( |
68 | 68 | ['<', '>'], |
69 | - ['<','>'], |
|
69 | + ['<', '>'], |
|
70 | 70 | str_replace( |
71 | 71 | '<?xml version="1.0"?>', |
72 | 72 | '<?xml version="1.0" encoding="UTF-8"?>', |
@@ -135,7 +135,7 @@ |
||
135 | 135 | '?', |
136 | 136 | $field |
137 | 137 | ); |
138 | - $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'. |
|
138 | + $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'. |
|
139 | 139 | '|\xED[\xA0-\xBF][\x80-\xBF]/S', '?', $newfield); |
140 | 140 | if ($field != $newfield) { |
141 | 141 | $errors[] = "ERRO: ($num) Existem caracteres não UTF-8, não permitidos, " |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | class ValidTXT |
19 | 19 | { |
20 | - const LOCAL="LOCAL"; |
|
20 | + const LOCAL = "LOCAL"; |
|
21 | 21 | const LOCAL_V12 = "LOCAL_V12"; |
22 | - const SEBRAE="SEBRAE"; |
|
22 | + const SEBRAE = "SEBRAE"; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Loads structure of txt from json file in storage folder |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } elseif (strtoupper($baselayout) === 'LOCAL_V12') { |
38 | 38 | $comp = '_v1.2'; |
39 | 39 | } |
40 | - $file = $path . '/txtstructure' . ($version*100) . $comp . '.json'; |
|
40 | + $file = $path . '/txtstructure' . ($version * 100) . $comp . '.json'; |
|
41 | 41 | if (!is_file($file)) { |
42 | 42 | throw new \InvalidArgumentException("O arquivo de estrutura para a " |
43 | 43 | . "versão de layout indicada no TXT, não foi encontrado [$file]."); |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | $errors[] = "ERRO: ($num) Essa referência não está definida. [$row]"; |
103 | 103 | continue; |
104 | 104 | } |
105 | - $count = count($fields)-1; |
|
106 | - $default = count(explode('|', $entities[$ref]))-1; |
|
105 | + $count = count($fields) - 1; |
|
106 | + $default = count(explode('|', $entities[$ref])) - 1; |
|
107 | 107 | if ($default !== $count) { |
108 | 108 | $errors[] = "ERRO: ($num) O número de parâmetros na linha " |
109 | 109 | . "está errado (esperado #$default) -> (encontrado #$count). [ $row ] Esperado [ " |
110 | - . $entities[$ref]." ]"; |
|
110 | + . $entities[$ref] . " ]"; |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | foreach ($fields as $field) { |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | continue; |
130 | 130 | } |
131 | 131 | $newfield = preg_replace( |
132 | - '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'. |
|
133 | - '|[\x00-\x7F][\x80-\xBF]+'. |
|
134 | - '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'. |
|
135 | - '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})'. |
|
132 | + '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]' . |
|
133 | + '|[\x00-\x7F][\x80-\xBF]+' . |
|
134 | + '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*' . |
|
135 | + '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})' . |
|
136 | 136 | '|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/S', |
137 | 137 | '?', |
138 | 138 | $field |
139 | 139 | ); |
140 | - $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'. |
|
140 | + $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]' . |
|
141 | 141 | '|\xED[\xA0-\xBF][\x80-\xBF]/S', '?', $newfield); |
142 | 142 | if ($field != $newfield) { |
143 | 143 | $errors[] = "ERRO: ($num) Existem caracteres não UTF-8, não permitidos, " |
@@ -144,16 +144,16 @@ discard block |
||
144 | 144 | $tpEmis, |
145 | 145 | $cDest |
146 | 146 | ) { |
147 | - $ver = $versao/100; |
|
147 | + $ver = $versao / 100; |
|
148 | 148 | $cscId = (int) $idToken; |
149 | 149 | $csc = $token; |
150 | 150 | if (strpos($url, '?p=') === false) { |
151 | - $url = $url.'?p='; |
|
151 | + $url = $url . '?p='; |
|
152 | 152 | } |
153 | 153 | if ($tpEmis != 9) { |
154 | 154 | //emissão on-line |
155 | 155 | $seq = "$chNFe|$ver|$tpAmb|$cscId"; |
156 | - $hash = strtoupper(sha1($seq.$csc)); |
|
156 | + $hash = strtoupper(sha1($seq . $csc)); |
|
157 | 157 | return "$url$seq|$hash"; |
158 | 158 | } |
159 | 159 | //emissão off-line |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $valor = number_format($vNF, 2, '.', ''); |
163 | 163 | $digHex = self::str2Hex($digVal); |
164 | 164 | $seq = "$chNFe|$ver|$tpAmb|$dia|$valor|$digHex|$cscId"; |
165 | - $hash = strtoupper(sha1($seq.$csc)); |
|
165 | + $hash = strtoupper(sha1($seq . $csc)); |
|
166 | 166 | return "$url$seq|$hash"; |
167 | 167 | } |
168 | 168 |
@@ -46,9 +46,9 @@ |
||
46 | 46 | */ |
47 | 47 | protected static function validInputData($data) |
48 | 48 | { |
49 | - $filejsonschema = __DIR__. "/../../storage/config.schema"; |
|
49 | + $filejsonschema = __DIR__ . "/../../storage/config.schema"; |
|
50 | 50 | $validator = new JsonValid(); |
51 | - $validator->check($data, (object)['$ref' => 'file://' . $filejsonschema]); |
|
51 | + $validator->check($data, (object) ['$ref' => 'file://' . $filejsonschema]); |
|
52 | 52 | if (!$validator->isValid()) { |
53 | 53 | $msg = ""; |
54 | 54 | foreach ($validator->getErrors() as $error) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * Canonical conversion options |
98 | 98 | * @var array |
99 | 99 | */ |
100 | - protected $canonical = [true,false,null,null]; |
|
100 | + protected $canonical = [true, false, null, null]; |
|
101 | 101 | /** |
102 | 102 | * Model of NFe 55 or 65 |
103 | 103 | * @var int |
@@ -299,8 +299,8 @@ discard block |
||
299 | 299 | $this->versao = $version; |
300 | 300 | $this->config->schemes = $this->availableVersions[$version]; |
301 | 301 | $this->pathschemes = realpath( |
302 | - __DIR__ . '/../../schemes/'. $this->config->schemes |
|
303 | - ).'/'; |
|
302 | + __DIR__ . '/../../schemes/' . $this->config->schemes |
|
303 | + ) . '/'; |
|
304 | 304 | |
305 | 305 | return $this->versao; |
306 | 306 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | */ |
401 | 401 | protected function isValid($version, $body, $method) |
402 | 402 | { |
403 | - $schema = $this->pathschemes.$method."_v$version.xsd"; |
|
403 | + $schema = $this->pathschemes . $method . "_v$version.xsd"; |
|
404 | 404 | if (!is_file($schema)) { |
405 | 405 | return true; |
406 | 406 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | } |
548 | 548 | |
549 | 549 | $path = $this->pathwsfiles . $file; |
550 | - if (! file_exists($path)) { |
|
550 | + if (!file_exists($path)) { |
|
551 | 551 | return ''; |
552 | 552 | } |
553 | 553 | return file_get_contents($path); |
@@ -601,7 +601,7 @@ |
||
601 | 601 | /** |
602 | 602 | * Verify if xml model is equal as modelo property |
603 | 603 | * @param string $xml |
604 | - * @return bool |
|
604 | + * @return boolean|null |
|
605 | 605 | */ |
606 | 606 | protected function checkModelFromXml($xml) |
607 | 607 | { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $comp = "_v1.2"; |
122 | 122 | } |
123 | 123 | $this->baselayout = $baselayout; |
124 | - $path = realpath(__DIR__."/../../storage/txtstructure$ver" . $comp . ".json"); |
|
124 | + $path = realpath(__DIR__ . "/../../storage/txtstructure$ver" . $comp . ".json"); |
|
125 | 125 | $this->structure = json_decode(file_get_contents($path), true); |
126 | 126 | $this->make = new Make(); |
127 | 127 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | if (empty($fields)) { |
153 | 153 | continue; |
154 | 154 | } |
155 | - $metodo = strtolower(str_replace(' ', '', $fields[0])).'Entity'; |
|
155 | + $metodo = strtolower(str_replace(' ', '', $fields[0])) . 'Entity'; |
|
156 | 156 | if (!method_exists(__CLASS__, $metodo)) { |
157 | 157 | throw DocumentsException::wrongDocument(16, $lin); //campo não definido |
158 | 158 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | protected static function fieldsToStd($dfls, $struct) |
172 | 172 | { |
173 | 173 | $sfls = explode('|', $struct); |
174 | - $len = count($sfls)-1; |
|
174 | + $len = count($sfls) - 1; |
|
175 | 175 | $std = new \stdClass(); |
176 | 176 | for ($i = 1; $i < $len; $i++) { |
177 | 177 | $name = $sfls[$i]; |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | $this->stdPIS->CST = $std->CST; |
1223 | 1223 | $this->stdPIS->vPIS = $std->vPIS; |
1224 | 1224 | $this->stdPIS->qBCProd = $std->qBCProd; |
1225 | - $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
1225 | + $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
1226 | 1226 | $this->buildQEntity(); |
1227 | 1227 | } |
1228 | 1228 | |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | protected function q10Entity($std) |
1274 | 1274 | { |
1275 | 1275 | $this->stdPIS->qBCProd = $std->qBCProd; |
1276 | - $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
1276 | + $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
1277 | 1277 | $this->buildQEntity(); |
1278 | 1278 | } |
1279 | 1279 |
@@ -7332,7 +7332,7 @@ |
||
7332 | 7332 | * Includes missing or unsupported properties in stdClass |
7333 | 7333 | * Replace all unsuported chars |
7334 | 7334 | * @param stdClass $std |
7335 | - * @param array $possible |
|
7335 | + * @param string[] $possible |
|
7336 | 7336 | * @return stdClass |
7337 | 7337 | */ |
7338 | 7338 | protected function equilizeParameters(stdClass $std, $possible) |