@@ -195,6 +195,9 @@ |
||
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | + /** |
|
| 199 | + * @param string $chave |
|
| 200 | + */ |
|
| 198 | 201 | protected function hashCSRT($csrt, $chave) |
| 199 | 202 | { |
| 200 | 203 | return strtoupper(base64_encode(sha1($csrt . $chave, true))); |
@@ -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]}]!"; |
@@ -328,6 +328,9 @@ |
||
| 328 | 328 | return $signed; |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | + /** |
|
| 332 | + * @param string $signed |
|
| 333 | + */ |
|
| 331 | 334 | protected function addQRCode($signed) |
| 332 | 335 | { |
| 333 | 336 | $dom = new Dom('1.0', 'UTF-8'); |
@@ -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); |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Constructor |
| 39 | - * @param NFePHP\Common\DOMImproved $dom |
|
| 39 | + * @param Dom $dom |
|
| 40 | 40 | */ |
| 41 | 41 | public function __construct(\NFePHP\Common\DOMImproved $dom = null) |
| 42 | 42 | { |
@@ -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; |
@@ -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 | |
@@ -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"?>', |