@@ -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 | */ |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $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, |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | $headerItems = ''; |
| 417 | 417 | foreach ($header->data as $key => $value) { |
| 418 | - $headerItems = '<'.$key.'>'.$value.'<'.$key.'>'; |
|
| 418 | + $headerItems = '<' . $key . '>' . $value . '<' . $key . '>'; |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | return sprintf( |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | { |
| 436 | 436 | $envelopeAttributes = ''; |
| 437 | 437 | foreach ($namespaces as $key => $value) { |
| 438 | - $envelopeAttributes = $key.'="'.$value.'"'; |
|
| 438 | + $envelopeAttributes = $key . '="' . $value . '"'; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | return $envelopeAttributes; |
@@ -453,9 +453,9 @@ discard block |
||
| 453 | 453 | ); |
| 454 | 454 | } |
| 455 | 455 | $this->certsdir = $this->certificate->getCnpj() . '/certs/'; |
| 456 | - $this->prifile = $this->certsdir. Strings::randomString(10).'.pem'; |
|
| 457 | - $this->pubfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
| 458 | - $this->certfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
| 456 | + $this->prifile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 457 | + $this->pubfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 458 | + $this->certfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 459 | 459 | $ret = true; |
| 460 | 460 | $private = $this->certificate->privateKey; |
| 461 | 461 | if ($this->encriptPrivateKey) { |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | ); |
| 481 | 481 | $ret &= $this->filesystem->put( |
| 482 | 482 | $this->certfile, |
| 483 | - $private."{$this->certificate}" |
|
| 483 | + $private . "{$this->certificate}" |
|
| 484 | 484 | ); |
| 485 | 485 | if (!$ret) { |
| 486 | 486 | throw new RuntimeException( |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | //utilize a API. Outra solução para remover arquivos "perdidos" pode ser |
| 507 | 507 | //encontrada oportunamente. |
| 508 | 508 | $dt = new \DateTime(); |
| 509 | - $tint = new \DateInterval("PT".$this->waitingTime."M"); |
|
| 509 | + $tint = new \DateInterval("PT" . $this->waitingTime . "M"); |
|
| 510 | 510 | $tint->invert = true; |
| 511 | 511 | $tsLimit = $dt->add($tint)->getTimestamp(); |
| 512 | 512 | foreach ($contents as $item) { |
@@ -10,6 +10,6 @@ |
||
| 10 | 10 | public function __construct(Certificate $certificate) |
| 11 | 11 | { |
| 12 | 12 | $invalidDate = $certificate->getValidFrom()->format('Y-m-d H:i'); |
| 13 | - parent::__construct('Certificate invalid from '.$invalidDate, 0, null); |
|
| 13 | + parent::__construct('Certificate invalid from ' . $invalidDate, 0, null); |
|
| 14 | 14 | } |
| 15 | 15 | } |