@@ -6,7 +6,6 @@ |
||
6 | 6 | * Abstract class to build Make::class |
7 | 7 | */ |
8 | 8 | use NFePHP\Common\DOMImproved as Dom; |
9 | -use NFePHP\Common\Keys; |
|
10 | 9 | use NFePHP\BPe\Factories\TagInterface; |
11 | 10 | use \DOMElement; |
12 | 11 |
@@ -186,7 +186,7 @@ |
||
186 | 186 | } |
187 | 187 | if (is_array($this->$node)) { |
188 | 188 | $n = count($this->$node); |
189 | - if ($n > $occur[1]) { |
|
189 | + if ($n > $occur[1]) { |
|
190 | 190 | //existem mais objetos que o permitido |
191 | 191 | $this->errors[] = "Existem mais objetos [tag{$node}: $n] " |
192 | 192 | . "que o limite permitido [max: {$occur[1]}]!"; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Return document key |
79 | - * @return type |
|
79 | + * @return string |
|
80 | 80 | */ |
81 | 81 | public function getChave() |
82 | 82 | { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Returns XML |
88 | - * @return type |
|
88 | + * @return string |
|
89 | 89 | */ |
90 | 90 | public function getXML() |
91 | 91 | { |
@@ -16,7 +16,6 @@ discard block |
||
16 | 16 | * @link http://github.com/nfephp-org/sped-bpe for the canonical source repository |
17 | 17 | */ |
18 | 18 | |
19 | -use DOMDocument; |
|
20 | 19 | use InvalidArgumentException; |
21 | 20 | use RuntimeException; |
22 | 21 | use NFePHP\Common\Certificate; |
@@ -29,7 +28,6 @@ discard block |
||
29 | 28 | use NFePHP\Common\UFList; |
30 | 29 | use NFePHP\Common\Validator; |
31 | 30 | use NFePHP\BPe\Factories\Header; |
32 | -use NFePHP\BPe\Factories\QRCode; |
|
33 | 31 | |
34 | 32 | class Tools |
35 | 33 | { |
@@ -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 BPe 63 |
103 | 103 | * @var int |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $this->config = json_decode($configJson); |
185 | 185 | $this->pathwsfiles = realpath( |
186 | 186 | __DIR__ . '/../../storage' |
187 | - ).'/'; |
|
187 | + ) . '/'; |
|
188 | 188 | $this->version($this->config->versao); |
189 | 189 | $this->setEnvironmentTimeZone($this->config->siglaUF); |
190 | 190 | $this->certificate = $certificate; |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | $this->versao = $version; |
262 | 262 | $this->config->schemes = $this->availableVersions[$version]; |
263 | 263 | $this->pathschemes = realpath( |
264 | - __DIR__ . '/../../schemes/'. $this->config->schemes |
|
265 | - ).'/'; |
|
264 | + __DIR__ . '/../../schemes/' . $this->config->schemes |
|
265 | + ) . '/'; |
|
266 | 266 | } |
267 | 267 | return $this->versao; |
268 | 268 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | */ |
393 | 393 | protected function isValid($version, $body, $method) |
394 | 394 | { |
395 | - $schema = $this->pathschemes.$method."_v$version.xsd"; |
|
395 | + $schema = $this->pathschemes . $method . "_v$version.xsd"; |
|
396 | 396 | if (!is_file($schema)) { |
397 | 397 | return true; |
398 | 398 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * @param array $opt |
421 | 421 | * @return array |
422 | 422 | */ |
423 | - public function canonicalOptions($opt = [true,false,null,null]) |
|
423 | + public function canonicalOptions($opt = [true, false, null, null]) |
|
424 | 424 | { |
425 | 425 | if (!empty($opt) && is_array($opt)) { |
426 | 426 | $this->canonical = $opt; |
@@ -510,8 +510,8 @@ discard block |
||
510 | 510 | { |
511 | 511 | $file = $this->pathwsfiles |
512 | 512 | . DIRECTORY_SEPARATOR |
513 | - . "wsbpe_".$this->versao."_mod63.xml"; |
|
514 | - if (! file_exists($file)) { |
|
513 | + . "wsbpe_" . $this->versao . "_mod63.xml"; |
|
514 | + if (!file_exists($file)) { |
|
515 | 515 | return ''; |
516 | 516 | } |
517 | 517 | return file_get_contents($file); |
@@ -349,6 +349,9 @@ |
||
349 | 349 | return $signed; |
350 | 350 | } |
351 | 351 | |
352 | + /** |
|
353 | + * @return string |
|
354 | + */ |
|
352 | 355 | protected function addQRCode($signed) |
353 | 356 | { |
354 | 357 | $dom = new Dom('1.0', 'UTF-8'); |
@@ -20,9 +20,7 @@ |
||
20 | 20 | use NFePHP\Common\Strings; |
21 | 21 | use NFePHP\Common\Signer; |
22 | 22 | use NFePHP\Common\UFList; |
23 | -use NFePHP\BPe\Factories\Events; |
|
24 | 23 | use NFePHP\BPe\Common\Tools as ToolsCommon; |
25 | -use RuntimeException; |
|
26 | 24 | use InvalidArgumentException; |
27 | 25 | |
28 | 26 | class Tools extends ToolsCommon |
@@ -231,7 +231,7 @@ |
||
231 | 231 | $dt = new \DateTime(); |
232 | 232 | $dhEvento = $dt->format('Y-m-d\TH:i:sP'); |
233 | 233 | $sSeqEvento = str_pad($nSeqEvento, 2, "0", STR_PAD_LEFT); |
234 | - $eventId = "ID".$tpEvento.$chave.$sSeqEvento; |
|
234 | + $eventId = "ID" . $tpEvento . $chave . $sSeqEvento; |
|
235 | 235 | $cOrgao = UFList::getCodeByUF($uf); |
236 | 236 | $request = "<eventoBPe xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
237 | 237 | . "<infEvento Id=\"$eventId\">" |
@@ -72,7 +72,7 @@ |
||
72 | 72 | //então se não puderem ser simultâneas aqui podemos remover qq um dos itens |
73 | 73 | //adicionais |
74 | 74 | if ($this->std->cnpj != null) { |
75 | - $this->std->cpf = null; |
|
75 | + $this->std->cpf = null; |
|
76 | 76 | $this->std->idestrangeiro = null; |
77 | 77 | } elseif ($this->std->cpf != null) { |
78 | 78 | $this->std->idestrangeiro = null; |
@@ -142,16 +142,16 @@ discard block |
||
142 | 142 | $tpEmis, |
143 | 143 | $cDest |
144 | 144 | ) { |
145 | - $ver = $versao/100; |
|
145 | + $ver = $versao / 100; |
|
146 | 146 | $cscId = (int) $idToken; |
147 | 147 | $csc = $token; |
148 | 148 | if (strpos($url, '?p=') === false) { |
149 | - $url = $url.'?p='; |
|
149 | + $url = $url . '?p='; |
|
150 | 150 | } |
151 | 151 | if ($tpEmis != 9) { |
152 | 152 | //emissão on-line |
153 | 153 | $seq = "$chNFe|$ver|$tpAmb|$cscId"; |
154 | - $hash = strtoupper(sha1($seq.$csc)); |
|
154 | + $hash = strtoupper(sha1($seq . $csc)); |
|
155 | 155 | return "$url$seq|$hash"; |
156 | 156 | } |
157 | 157 | //emissão off-line |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $valor = number_format($vNF, 2, '.', ''); |
161 | 161 | $digHex = self::str2Hex($digVal); |
162 | 162 | $seq = "$chNFe|$ver|$tpAmb|$dia|$valor|$digHex|$cscId"; |
163 | - $hash = strtoupper(sha1($seq.$csc)); |
|
163 | + $hash = strtoupper(sha1($seq . $csc)); |
|
164 | 164 | return "$url$seq|$hash"; |
165 | 165 | } |
166 | 166 |
@@ -295,8 +295,8 @@ |
||
295 | 295 | $mdec = strpos($n[1], '-'); |
296 | 296 | $numberasstring = number_format($value, 0, '.', ''); |
297 | 297 | $p = explode('.', $value); |
298 | - $ndec = !empty($p[1]) ? strlen((string) $p[1]) : 0;//decimal digits |
|
299 | - $nint = strlen($numberasstring);//integer digits |
|
298 | + $ndec = !empty($p[1]) ? strlen((string) $p[1]) : 0; //decimal digits |
|
299 | + $nint = strlen($numberasstring); //integer digits |
|
300 | 300 | if ($nint > $n[0]) { |
301 | 301 | $this->errors[] = "O numero [$value] é maior que o permitido [$format]."; |
302 | 302 | return $value; |
@@ -101,6 +101,9 @@ |
||
101 | 101 | return $node; |
102 | 102 | } |
103 | 103 | |
104 | + /** |
|
105 | + * @param stdClass $std |
|
106 | + */ |
|
104 | 107 | protected function checkIfContentsExists($std) |
105 | 108 | { |
106 | 109 | $response = false; |
@@ -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"?>', |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | //wrong document, this document is not able to recieve a protocol |
26 | 26 | throw DocumentsException::wrongDocument(0, $key); |
27 | 27 | } |
28 | - $func = "add".$key."Protocol"; |
|
28 | + $func = "add" . $key . "Protocol"; |
|
29 | 29 | return self::$func($request, $response); |
30 | 30 | } |
31 | 31 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $ret->loadXML($response); |
186 | 186 | //extrai a rag retEvento da resposta (retorno da SEFAZ) |
187 | 187 | $retEv = $ret->getElementsByTagName('retEventoBPe')->item(0); |
188 | - $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
188 | + $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
189 | 189 | $xMotivo = $retEv->getElementsByTagName('xMotivo')->item(0)->nodeValue; |
190 | 190 | $tpEvento = $retEv->getElementsByTagName('tpEvento')->item(0)->nodeValue; |
191 | 191 | $cStatValids = ['135', '136']; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | { |
216 | 216 | $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
217 | 217 | . "<$nodename versao=\"$versao\" " |
218 | - . "xmlns=\"".self::$urlPortal."\">"; |
|
218 | + . "xmlns=\"" . self::$urlPortal . "\">"; |
|
219 | 219 | $xml .= $first; |
220 | 220 | $xml .= $second; |
221 | 221 | $xml .= "</$nodename>"; |