@@ -22,7 +22,7 @@ |
||
| 22 | 22 | { |
| 23 | 23 | public static function info($code) |
| 24 | 24 | { |
| 25 | - $codes = (array) json_decode(file_get_contents(__DIR__.'/httpcodes.json'), true); |
|
| 25 | + $codes = (array) json_decode(file_get_contents(__DIR__ . '/httpcodes.json'), true); |
|
| 26 | 26 | if (array_key_exists($code, $codes)) { |
| 27 | 27 | return $codes[$code]; |
| 28 | 28 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | curl_setopt($oCurl, CURLOPT_KEYPASSWD, $this->temppass); |
| 79 | 79 | } |
| 80 | 80 | curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, true); |
| 81 | - if (! empty($envelope)) { |
|
| 81 | + if (!empty($envelope)) { |
|
| 82 | 82 | curl_setopt($oCurl, CURLOPT_POST, true); |
| 83 | 83 | curl_setopt($oCurl, CURLOPT_POSTFIELDS, $envelope); |
| 84 | 84 | curl_setopt($oCurl, CURLOPT_HTTPHEADER, $parameters); |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | if ($this->proxyIP != '') { |
| 160 | 160 | curl_setopt($oCurl, CURLOPT_HTTPPROXYTUNNEL, 1); |
| 161 | 161 | curl_setopt($oCurl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); |
| 162 | - curl_setopt($oCurl, CURLOPT_PROXY, $this->proxyIP.':'.$this->proxyPort); |
|
| 162 | + curl_setopt($oCurl, CURLOPT_PROXY, $this->proxyIP . ':' . $this->proxyPort); |
|
| 163 | 163 | if ($this->proxyUser != '') { |
| 164 | - curl_setopt($oCurl, CURLOPT_PROXYUSERPWD, $this->proxyUser.':'.$this->proxyPass); |
|
| 164 | + curl_setopt($oCurl, CURLOPT_PROXYUSERPWD, $this->proxyUser . ':' . $this->proxyPass); |
|
| 165 | 165 | curl_setopt($oCurl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $html .= '<h2>body</h2>'; |
| 51 | 51 | $html .= str_replace( |
| 52 | 52 | ['<', '>'], |
| 53 | - ['<','>'], |
|
| 53 | + ['<', '>'], |
|
| 54 | 54 | str_replace( |
| 55 | 55 | '<?xml version="1.0"?>', |
| 56 | 56 | '<?xml version="1.0" encoding="UTF-8"?>', |
@@ -384,9 +384,9 @@ discard block |
||
| 384 | 384 | ); |
| 385 | 385 | } |
| 386 | 386 | $this->certsdir = $this->certificate->getCnpj() . '/certs/'; |
| 387 | - $this->prifile = $this->certsdir. Strings::randomString(10).'.pem'; |
|
| 388 | - $this->pubfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
| 389 | - $this->certfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
| 387 | + $this->prifile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 388 | + $this->pubfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 389 | + $this->certfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 390 | 390 | $ret = true; |
| 391 | 391 | $private = $this->certificate->privateKey; |
| 392 | 392 | if ($this->encriptPrivateKey) { |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | ); |
| 412 | 412 | $ret &= $this->filesystem->put( |
| 413 | 413 | $this->certfile, |
| 414 | - $private."{$this->certificate}" |
|
| 414 | + $private . "{$this->certificate}" |
|
| 415 | 415 | ); |
| 416 | 416 | if (!$ret) { |
| 417 | 417 | throw new RuntimeException( |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | //utilize a API. Outra solução para remover arquivos "perdidos" pode ser |
| 438 | 438 | //encontrada oportunamente. |
| 439 | 439 | $dt = new \DateTime(); |
| 440 | - $tint = new \DateInterval("PT".$this->waitingTime."M"); |
|
| 440 | + $tint = new \DateInterval("PT" . $this->waitingTime . "M"); |
|
| 441 | 441 | $tint->invert = 1; |
| 442 | 442 | $tsLimit = $dt->add($tint)->getTimestamp(); |
| 443 | 443 | foreach ($contents as $item) { |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | $this->node->insertBefore($ideEvento, $ideContri); |
| 74 | 74 | //tag deste evento em particular |
| 75 | 75 | $info = $this->dom->createElement("infoProcesso"); |
| 76 | - $ideProcesso = $this->dom->createElement("ideProcesso"); |
|
| 76 | + $ideProcesso = $this->dom->createElement("ideProcesso"); |
|
| 77 | 77 | $this->dom->addChild( |
| 78 | 78 | $ideProcesso, |
| 79 | 79 | "tpProc", |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $x = substr($input, 5, 6); |
| 56 | 56 | $y = substr($input, 11, 4); |
| 57 | 57 | $dd = substr($input, -2); |
| 58 | - $value = $n.$x.$y; |
|
| 58 | + $value = $n . $x . $y; |
|
| 59 | 59 | $a = str_split($value); |
| 60 | 60 | $soma = 0; |
| 61 | 61 | $i = 16; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | if ($m2 > 9) { |
| 79 | 79 | $m2 -= 10; |
| 80 | 80 | } |
| 81 | - return $m1.$m2; |
|
| 81 | + return $m1 . $m2; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | protected static function clearString($input, $lenght) |
| 108 | 108 | { |
| 109 | - $input = str_replace(['-','/','.'], '', $input); |
|
| 110 | - $input = substr($input, 0, $lenght-1); |
|
| 109 | + $input = str_replace(['-', '/', '.'], '', $input); |
|
| 110 | + $input = substr($input, 0, $lenght - 1); |
|
| 111 | 111 | $input = str_pad($input, $lenght, '0', STR_PAD_RIGHT); |
| 112 | 112 | if (!preg_match('/^[0-9]+$/', $input)) { |
| 113 | 113 | throw new \InvalidArgumentException("O numero do processo tem estrutura incorreta."); |
@@ -97,17 +97,17 @@ discard block |
||
| 97 | 97 | * @var array |
| 98 | 98 | */ |
| 99 | 99 | protected $grupos = [ |
| 100 | - 1 => [ //EVENTOS INICIAIS grupo [1] |
|
| 100 | + 1 => [//EVENTOS INICIAIS grupo [1] |
|
| 101 | 101 | 'R-1000', |
| 102 | 102 | 'R-1070' |
| 103 | 103 | ], |
| 104 | - 2 => [ //EVENTOS NÃO PERIÓDICOS grupo [2] |
|
| 104 | + 2 => [//EVENTOS NÃO PERIÓDICOS grupo [2] |
|
| 105 | 105 | 'R-3010', |
| 106 | 106 | 'R-5001', |
| 107 | 107 | 'R-5011', |
| 108 | 108 | 'R-9000' |
| 109 | 109 | ], |
| 110 | - 3 => [ //EVENTOS PERIÓDICOS grupo [3] |
|
| 110 | + 3 => [//EVENTOS PERIÓDICOS grupo [3] |
|
| 111 | 111 | 'R-2010', |
| 112 | 112 | 'R-2020', |
| 113 | 113 | 'R-2030', |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $this->path = realpath( |
| 147 | 147 | __DIR__ . '/../../' |
| 148 | - ).'/'; |
|
| 148 | + ) . '/'; |
|
| 149 | 149 | |
| 150 | 150 | $this->serviceXsd = XsdSeeker::seek( |
| 151 | 151 | $this->path . "schemes/comunicacao/v$this->serviceVersion/" |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $properties = [ |
| 263 | 263 | 'perapur' => [ |
| 264 | 264 | 'required' => false, |
| 265 | - 'type' => ['string',"null"], |
|
| 265 | + 'type' => ['string', "null"], |
|
| 266 | 266 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 267 | 267 | ], |
| 268 | 268 | 'tpinscestab' => [ |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | . "<sped:tpInsc>{$this->tpInsc}</sped:tpInsc>" |
| 292 | 292 | . "<sped:nrInsc>{$this->doc}</sped:nrInsc>"; |
| 293 | 293 | if (!empty($std->perapur)) { |
| 294 | - $request .= "<sped:perApur>{$std->perapur}</sped:perApur>"; |
|
| 294 | + $request .= "<sped:perApur>{$std->perapur}</sped:perApur>"; |
|
| 295 | 295 | } |
| 296 | 296 | $request .= "<sped:tpInscEstab>{$std->tpinscestab}</sped:tpInscEstab>" |
| 297 | 297 | . "<sped:nrInscEstab>" |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $properties = [ |
| 316 | 316 | 'perapur' => [ |
| 317 | 317 | 'required' => false, |
| 318 | - 'type' => ['string',"null"], |
|
| 318 | + 'type' => ['string', "null"], |
|
| 319 | 319 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 320 | 320 | ], |
| 321 | 321 | 'nrinscestabprest' => [ |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | $properties = [ |
| 367 | 367 | 'perapur' => [ |
| 368 | 368 | 'required' => false, |
| 369 | - 'type' => ['string',"null"], |
|
| 369 | + 'type' => ['string', "null"], |
|
| 370 | 370 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 371 | 371 | ], |
| 372 | 372 | 'nrinscestab' => [ |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | $properties = [ |
| 410 | 410 | 'perapur' => [ |
| 411 | 411 | 'required' => false, |
| 412 | - 'type' => ['string',"null"], |
|
| 412 | + 'type' => ['string', "null"], |
|
| 413 | 413 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 414 | 414 | ], |
| 415 | 415 | 'nrinscestab' => [ |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $properties = [ |
| 455 | 455 | 'perapur' => [ |
| 456 | 456 | 'required' => false, |
| 457 | - 'type' => ['string',"null"], |
|
| 457 | + 'type' => ['string', "null"], |
|
| 458 | 458 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 459 | 459 | ], |
| 460 | 460 | 'nrinscestabprest' => [ |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | $properties = [ |
| 505 | 505 | 'perapur' => [ |
| 506 | 506 | 'required' => false, |
| 507 | - 'type' => ['string',"null"], |
|
| 507 | + 'type' => ['string', "null"], |
|
| 508 | 508 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 509 | 509 | ], |
| 510 | 510 | ]; |
@@ -588,20 +588,20 @@ discard block |
||
| 588 | 588 | throw ProcessException::wrongArgument(2002, ''); |
| 589 | 589 | } |
| 590 | 590 | //verifica se o evento pertence ao grupo indicado |
| 591 | - if (! in_array($evt->alias(), $this->grupos[$grupo])) { |
|
| 591 | + if (!in_array($evt->alias(), $this->grupos[$grupo])) { |
|
| 592 | 592 | throw new \RuntimeException( |
| 593 | 593 | 'O evento ' . $evt->alias() . ' não pertence a este grupo [ ' |
| 594 | 594 | . $this->eventGroup[$grupo] . ' ].' |
| 595 | 595 | ); |
| 596 | 596 | } |
| 597 | 597 | $this->checkCertificate($evt); |
| 598 | - $xml .= "<evento id=\"".$evt->getId()."\">"; |
|
| 598 | + $xml .= "<evento id=\"" . $evt->getId() . "\">"; |
|
| 599 | 599 | $xml .= $evt->toXML(); |
| 600 | 600 | $xml .= "</evento>"; |
| 601 | 601 | } |
| 602 | 602 | //build request |
| 603 | 603 | $request = "<Reinf xmlns=\"http://www.reinf.esocial.gov.br/schemas/envioLoteEventos/v" |
| 604 | - . $this->serviceVersion."\" >" |
|
| 604 | + . $this->serviceVersion . "\" >" |
|
| 605 | 605 | . "<loteEventos>" |
| 606 | 606 | . $xml |
| 607 | 607 | . "</loteEventos>" |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $part = explode(' ', $name); |
| 35 | 35 | if (count($part) > 14) { |
| 36 | 36 | $name = ''; |
| 37 | - for ($x=0; $x<=14; $x++) { |
|
| 37 | + for ($x = 0; $x <= 14; $x++) { |
|
| 38 | 38 | //não permite parte com maisnde 21 caracteres (regra 6) |
| 39 | 39 | if (strlen($part[$x]) > 21) { |
| 40 | 40 | $part[$x] = substr($part[$x], 0, 21); |