@@ -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 | } |
@@ -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."); |
@@ -290,7 +290,7 @@ |
||
| 290 | 290 | 'required' => false, |
| 291 | 291 | 'type' => ['string',"null"], |
| 292 | 292 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 293 | - ], |
|
| 293 | + ], |
|
| 294 | 294 | 'nrinscestabprest' => [ |
| 295 | 295 | 'required' => true, |
| 296 | 296 | 'type' => 'string', |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | public function __construct($config, Certificate $certificate) |
| 119 | 119 | { |
| 120 | 120 | parent::__construct($config, $certificate); |
| 121 | - $this->xsdassincrono = __DIR__.'/../schemes/v2_01_01/envioLoteEventosAssincrono-v1_00_00.xsd'; |
|
| 121 | + $this->xsdassincrono = __DIR__ . '/../schemes/v2_01_01/envioLoteEventosAssincrono-v1_00_00.xsd'; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $properties = [ |
| 290 | 290 | 'perapur' => [ |
| 291 | 291 | 'required' => false, |
| 292 | - 'type' => ['string',"null"], |
|
| 292 | + 'type' => ['string', "null"], |
|
| 293 | 293 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 294 | 294 | ], |
| 295 | 295 | 'tpinscestab' => [ |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | . "<sped:tpInsc>{$this->tpInsc}</sped:tpInsc>" |
| 319 | 319 | . "<sped:nrInsc>{$this->doc}</sped:nrInsc>"; |
| 320 | 320 | if (!empty($std->perapur)) { |
| 321 | - $request .= "<sped:perApur>{$std->perapur}</sped:perApur>"; |
|
| 321 | + $request .= "<sped:perApur>{$std->perapur}</sped:perApur>"; |
|
| 322 | 322 | } |
| 323 | 323 | $request .= "<sped:tpInscEstab>{$std->tpinscestab}</sped:tpInscEstab>" |
| 324 | 324 | . "<sped:nrInscEstab>" |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $properties = [ |
| 343 | 343 | 'perapur' => [ |
| 344 | 344 | 'required' => false, |
| 345 | - 'type' => ['string',"null"], |
|
| 345 | + 'type' => ['string', "null"], |
|
| 346 | 346 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 347 | 347 | ], |
| 348 | 348 | 'nrinscestabprest' => [ |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | $properties = [ |
| 394 | 394 | 'perapur' => [ |
| 395 | 395 | 'required' => false, |
| 396 | - 'type' => ['string',"null"], |
|
| 396 | + 'type' => ['string', "null"], |
|
| 397 | 397 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 398 | 398 | ], |
| 399 | 399 | 'nrinscestab' => [ |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | $properties = [ |
| 437 | 437 | 'perapur' => [ |
| 438 | 438 | 'required' => false, |
| 439 | - 'type' => ['string',"null"], |
|
| 439 | + 'type' => ['string', "null"], |
|
| 440 | 440 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 441 | 441 | ], |
| 442 | 442 | 'nrinscestab' => [ |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | $properties = [ |
| 482 | 482 | 'perapur' => [ |
| 483 | 483 | 'required' => false, |
| 484 | - 'type' => ['string',"null"], |
|
| 484 | + 'type' => ['string', "null"], |
|
| 485 | 485 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 486 | 486 | ], |
| 487 | 487 | 'nrinscestabprest' => [ |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | $properties = [ |
| 532 | 532 | 'perapur' => [ |
| 533 | 533 | 'required' => false, |
| 534 | - 'type' => ['string',"null"], |
|
| 534 | + 'type' => ['string', "null"], |
|
| 535 | 535 | 'regex' => '^(19[0-9][0-9]|2[0-9][0-9][0-9])[-](0?[1-9]|1[0-2])$' |
| 536 | 536 | ], |
| 537 | 537 | ]; |
@@ -615,20 +615,20 @@ discard block |
||
| 615 | 615 | throw ProcessException::wrongArgument(2002, ''); |
| 616 | 616 | } |
| 617 | 617 | //verifica se o evento pertence ao grupo indicado |
| 618 | - if (! in_array($evt->alias(), $this->grupos[$grupo])) { |
|
| 618 | + if (!in_array($evt->alias(), $this->grupos[$grupo])) { |
|
| 619 | 619 | throw new \RuntimeException( |
| 620 | 620 | 'O evento ' . $evt->alias() . ' não pertence a este grupo [ ' |
| 621 | 621 | . $this->eventGroup[$grupo] . ' ].' |
| 622 | 622 | ); |
| 623 | 623 | } |
| 624 | 624 | $this->checkCertificate($evt); |
| 625 | - $xml .= "<evento id=\"".$evt->getId()."\">"; |
|
| 625 | + $xml .= "<evento id=\"" . $evt->getId() . "\">"; |
|
| 626 | 626 | $xml .= $evt->toXML(); |
| 627 | 627 | $xml .= "</evento>"; |
| 628 | 628 | } |
| 629 | 629 | //build request |
| 630 | 630 | $request = "<Reinf xmlns=\"http://www.reinf.esocial.gov.br/schemas/envioLoteEventos/v" |
| 631 | - . $this->serviceVersion."\" >" |
|
| 631 | + . $this->serviceVersion . "\" >" |
|
| 632 | 632 | . "<loteEventos>" |
| 633 | 633 | . $xml |
| 634 | 634 | . "</loteEventos>" |
@@ -670,20 +670,20 @@ discard block |
||
| 670 | 670 | throw ProcessException::wrongArgument(2002, ''); |
| 671 | 671 | } |
| 672 | 672 | //verifica se o evento pertence ao grupo indicado |
| 673 | - if (! in_array($evt->alias(), $this->grupos[$grupo])) { |
|
| 673 | + if (!in_array($evt->alias(), $this->grupos[$grupo])) { |
|
| 674 | 674 | throw new \RuntimeException( |
| 675 | 675 | 'O evento ' . $evt->alias() . ' não pertence a este grupo [ ' |
| 676 | 676 | . $this->eventGroup[$grupo] . ' ].' |
| 677 | 677 | ); |
| 678 | 678 | } |
| 679 | 679 | $this->checkCertificate($evt); |
| 680 | - $xml .= "<evento Id=\"".$evt->getId()."\">"; |
|
| 680 | + $xml .= "<evento Id=\"" . $evt->getId() . "\">"; |
|
| 681 | 681 | $xml .= $evt->toXML(); |
| 682 | 682 | $xml .= "</evento>"; |
| 683 | 683 | } |
| 684 | 684 | $content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
| 685 | 685 | . "<Reinf xmlns=\"http://www.reinf.esocial.gov.br/schemas/envioLoteEventosAssincrono/v" |
| 686 | - . $this->serviceVersion."\">" |
|
| 686 | + . $this->serviceVersion . "\">" |
|
| 687 | 687 | . "<envioLoteEventos>" |
| 688 | 688 | . "<ideContribuinte>" |
| 689 | 689 | . "<tpInsc>{$this->tpInsc}</tpInsc>" |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | } |
| 748 | 748 | $content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
| 749 | 749 | . "<Reinf xmlns=\"http://www.reinf.esocial.gov.br/schemas/envioLoteEventosAssincrono/v" |
| 750 | - . $this->serviceVersion."\">" |
|
| 750 | + . $this->serviceVersion . "\">" |
|
| 751 | 751 | . "<envioLoteEventos>" |
| 752 | 752 | . "<ideContribuinte>" |
| 753 | 753 | . "<tpInsc>{$this->tpInsc}</tpInsc>" |
@@ -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); |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | return true; |
| 242 | 242 | } |
| 243 | 243 | $validator = new JsonValid(); |
| 244 | - $validator->check($data, (object)['$ref' => 'file://' . $this->jsonschema]); |
|
| 244 | + $validator->check($data, (object) ['$ref' => 'file://' . $this->jsonschema]); |
|
| 245 | 245 | if (!$validator->isValid()) { |
| 246 | 246 | $msg = ""; |
| 247 | 247 | foreach ($validator->getErrors() as $error) { |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $this->dom->addChild( |
| 296 | 296 | $ideContri, |
| 297 | 297 | "tpInsc", |
| 298 | - (string)$this->tpInsc, |
|
| 298 | + (string) $this->tpInsc, |
|
| 299 | 299 | true |
| 300 | 300 | ); |
| 301 | 301 | $this->dom->addChild( |
@@ -78,7 +78,7 @@ |
||
| 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); |
@@ -324,9 +324,9 @@ discard block |
||
| 324 | 324 | if ($this->proxyIP != '') { |
| 325 | 325 | curl_setopt($oCurl, CURLOPT_HTTPPROXYTUNNEL, 1); |
| 326 | 326 | curl_setopt($oCurl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); |
| 327 | - curl_setopt($oCurl, CURLOPT_PROXY, $this->proxyIP.':'.$this->proxyPort); |
|
| 327 | + curl_setopt($oCurl, CURLOPT_PROXY, $this->proxyIP . ':' . $this->proxyPort); |
|
| 328 | 328 | if ($this->proxyUser != '') { |
| 329 | - curl_setopt($oCurl, CURLOPT_PROXYUSERPWD, $this->proxyUser.':'.$this->proxyPass); |
|
| 329 | + curl_setopt($oCurl, CURLOPT_PROXYUSERPWD, $this->proxyUser . ':' . $this->proxyPass); |
|
| 330 | 330 | curl_setopt($oCurl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); |
| 331 | 331 | } |
| 332 | 332 | } |
@@ -356,9 +356,9 @@ discard block |
||
| 356 | 356 | ); |
| 357 | 357 | } |
| 358 | 358 | $this->certsdir = $this->certificate->getCnpj() . '/certs/'; |
| 359 | - $this->prifile = $this->certsdir. Strings::randomString(10).'.pem'; |
|
| 360 | - $this->pubfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
| 361 | - $this->certfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
| 359 | + $this->prifile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 360 | + $this->pubfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 361 | + $this->certfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 362 | 362 | $ret = true; |
| 363 | 363 | $private = $this->certificate->privateKey; |
| 364 | 364 | if ($this->encriptPrivateKey) { |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | //utilize a API. Outra solução para remover arquivos "perdidos" pode ser |
| 411 | 411 | //encontrada oportunamente. |
| 412 | 412 | $dt = new \DateTime(); |
| 413 | - $tint = new \DateInterval("PT".$this->waitingTime."M"); |
|
| 413 | + $tint = new \DateInterval("PT" . $this->waitingTime . "M"); |
|
| 414 | 414 | $tint->invert = 1; |
| 415 | 415 | $tsLimit = $dt->add($tint)->getTimestamp(); |
| 416 | 416 | foreach ($contents as $item) { |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | true |
| 88 | 88 | ); |
| 89 | 89 | if ($this->std->modo == 'INC') { |
| 90 | - // $this->std->fimvalid = null; |
|
| 90 | + // $this->std->fimvalid = null; |
|
| 91 | 91 | } |
| 92 | 92 | $this->dom->addChild( |
| 93 | 93 | $idePeriodo, |