@@ -17,9 +17,9 @@ |
||
| 17 | 17 | { |
| 18 | 18 | $msg = ''; |
| 19 | 19 | foreach ($errors as $error) { |
| 20 | - $msg .= $error."\n"; |
|
| 20 | + $msg .= $error . "\n"; |
|
| 21 | 21 | } |
| 22 | - return new static('This XML is not valid. '.$msg); |
|
| 22 | + return new static('This XML is not valid. ' . $msg); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public static function isNotXml() |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $dom->formatOutput = false; |
| 40 | 40 | $dom->loadXML($xml, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG); |
| 41 | 41 | libxml_clear_errors(); |
| 42 | - if (! $dom->schemaValidate($xsd)) { |
|
| 42 | + if (!$dom->schemaValidate($xsd)) { |
|
| 43 | 43 | $errors = []; |
| 44 | 44 | foreach (libxml_get_errors() as $error) { |
| 45 | 45 | $errors[] = $error->message; |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | public static function replaceSpecialsChars($string) |
| 24 | 24 | { |
| 25 | 25 | $string = trim($string); |
| 26 | - $aFind = ['&','á','à','ã','â','é','ê','í','ó','ô','õ','ú','ü', |
|
| 27 | - 'ç','Á','À','Ã','Â','É','Ê','Í','Ó','Ô','Õ','Ú','Ü','Ç']; |
|
| 28 | - $aSubs = ['e','a','a','a','a','e','e','i','o','o','o','u','u', |
|
| 29 | - 'c','A','A','A','A','E','E','I','O','O','O','U','U','C']; |
|
| 26 | + $aFind = ['&', 'á', 'à', 'ã', 'â', 'é', 'ê', 'í', 'ó', 'ô', 'õ', 'ú', 'ü', |
|
| 27 | + 'ç', 'Á', 'À', 'Ã', 'Â', 'É', 'Ê', 'Í', 'Ó', 'Ô', 'Õ', 'Ú', 'Ü', 'Ç']; |
|
| 28 | + $aSubs = ['e', 'a', 'a', 'a', 'a', 'e', 'e', 'i', 'o', 'o', 'o', 'u', 'u', |
|
| 29 | + 'c', 'A', 'A', 'A', 'A', 'E', 'E', 'I', 'O', 'O', 'O', 'U', 'U', 'C']; |
|
| 30 | 30 | $newstr = str_replace($aFind, $aSubs, $string); |
| 31 | 31 | $newstr = preg_replace("/[^a-zA-Z0-9 @,-_.;:\/]/", "", $newstr); |
| 32 | 32 | return $newstr; |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | public static function clearProtocoledXML($string) |
| 95 | 95 | { |
| 96 | 96 | $procXML = self::clearXmlString($string); |
| 97 | - $aApp = array('nfe','cte','mdfe'); |
|
| 97 | + $aApp = array('nfe', 'cte', 'mdfe'); |
|
| 98 | 98 | foreach ($aApp as $app) { |
| 99 | 99 | $procXML = str_replace( |
| 100 | - 'xmlns="http://www.portalfiscal.inf.br/'.$app.'" xmlns="http://www.w3.org/2000/09/xmldsig#"', |
|
| 101 | - 'xmlns="http://www.portalfiscal.inf.br/'.$app.'"', |
|
| 100 | + 'xmlns="http://www.portalfiscal.inf.br/' . $app . '" xmlns="http://www.w3.org/2000/09/xmldsig#"', |
|
| 101 | + 'xmlns="http://www.portalfiscal.inf.br/' . $app . '"', |
|
| 102 | 102 | $procXML |
| 103 | 103 | ); |
| 104 | 104 | } |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | public static function removeSomeAlienCharsfromTxt($txt) |
| 114 | 114 | { |
| 115 | 115 | //remove CRs and TABs |
| 116 | - $txt = str_replace(["\r","\t"], "", $txt); |
|
| 116 | + $txt = str_replace(["\r", "\t"], "", $txt); |
|
| 117 | 117 | //remove multiple spaces |
| 118 | 118 | $txt = preg_replace('/(?:\s\s+)/', ' ', $txt); |
| 119 | 119 | //remove spaces at begin and end of fields |
| 120 | - $txt = str_replace(["| "," |"], "|", $txt); |
|
| 120 | + $txt = str_replace(["| ", " |"], "|", $txt); |
|
| 121 | 121 | return $txt; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -358,7 +358,7 @@ |
||
| 358 | 358 | * Mount soap envelope |
| 359 | 359 | * @param string $request |
| 360 | 360 | * @param array $namespaces |
| 361 | - * @param $soapVer int |
|
| 361 | + * @param integer $soapVer int |
|
| 362 | 362 | * @param \SOAPHeader $header |
| 363 | 363 | * @return string |
| 364 | 364 | */ |
@@ -58,9 +58,9 @@ |
||
| 58 | 58 | * @var LoggerInterface |
| 59 | 59 | */ |
| 60 | 60 | protected $logger; |
| 61 | - /** |
|
| 62 | - * @var string |
|
| 63 | - */ |
|
| 61 | + /** |
|
| 62 | + * @var string |
|
| 63 | + */ |
|
| 64 | 64 | protected $tempdir; |
| 65 | 65 | /** |
| 66 | 66 | * @var string |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | string $bodyContent = '' |
| 393 | 393 | ) { |
| 394 | 394 | return sprintf( |
| 395 | - '<%s:Envelope %s >'.$header.'<%s:Body>%s</%s:Body></%s:Envelop>', |
|
| 395 | + '<%s:Envelope %s >' . $header . '<%s:Body>%s</%s:Body></%s:Envelop>', |
|
| 396 | 396 | $envelopPrefix, |
| 397 | 397 | $envelopAttributes, |
| 398 | 398 | $envelopPrefix, |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | { |
| 412 | 412 | $headerItems = ''; |
| 413 | 413 | foreach ($header->data as $key => $value) { |
| 414 | - $headerItems = '<'.$key.'>'.$value.'<'.$key.'>'; |
|
| 414 | + $headerItems = '<' . $key . '>' . $value . '<' . $key . '>'; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | return |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | private function getStringAttributes($namespaces = []) |
| 432 | 432 | { |
| 433 | 433 | foreach ($namespaces as $key => $value) { |
| 434 | - $envelopeAttributes = $key.'="'.$value.'"'; |
|
| 434 | + $envelopeAttributes = $key . '="' . $value . '"'; |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | return $envelopeAttributes ?? ''; |
@@ -449,9 +449,9 @@ discard block |
||
| 449 | 449 | ); |
| 450 | 450 | } |
| 451 | 451 | $this->certsdir = $this->certificate->getCnpj() . '/certs/'; |
| 452 | - $this->prifile = $this->certsdir. Strings::randomString(10).'.pem'; |
|
| 453 | - $this->pubfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
| 454 | - $this->certfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
| 452 | + $this->prifile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 453 | + $this->pubfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 454 | + $this->certfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 455 | 455 | $ret = true; |
| 456 | 456 | $private = $this->certificate->privateKey; |
| 457 | 457 | if ($this->encriptPrivateKey) { |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | ); |
| 477 | 477 | $ret &= $this->filesystem->put( |
| 478 | 478 | $this->certfile, |
| 479 | - $private."{$this->certificate}" |
|
| 479 | + $private . "{$this->certificate}" |
|
| 480 | 480 | ); |
| 481 | 481 | if (!$ret) { |
| 482 | 482 | throw new RuntimeException( |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | //utilize a API. Outra solução para remover arquivos "perdidos" pode ser |
| 503 | 503 | //encontrada oportunamente. |
| 504 | 504 | $dt = new \DateTime(); |
| 505 | - $tint = new \DateInterval("PT".$this->waitingTime."M"); |
|
| 505 | + $tint = new \DateInterval("PT" . $this->waitingTime . "M"); |
|
| 506 | 506 | $tint->invert = true; |
| 507 | 507 | $tsLimit = $dt->add($tint)->getTimestamp(); |
| 508 | 508 | foreach ($contents as $item) { |