@@ -273,8 +273,8 @@ discard block |
||
| 273 | 273 | . $this->uid() |
| 274 | 274 | .'/' |
| 275 | 275 | . $mapto |
| 276 | - . '/' ; |
|
| 277 | - $folderRealPath = sys_get_temp_dir().$path; |
|
| 276 | + . '/'; |
|
| 277 | + $folderRealPath = sys_get_temp_dir() . $path; |
|
| 278 | 278 | } |
| 279 | 279 | if (substr($folderRealPath, -1) !== '/') { |
| 280 | 280 | $folderRealPath .= '/'; |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | if (!$this->filesystem->has($name)) { |
| 564 | 564 | return $name; |
| 565 | 565 | } |
| 566 | - $this->randomName($n+5); |
|
| 566 | + $this->randomName($n + 5); |
|
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | /** |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | //remove todos os arquivos antigos |
| 584 | 584 | $contents = $this->filesystem->listContents($this->certsdir, true); |
| 585 | 585 | $dt = new \DateTime(); |
| 586 | - $tint = new \DateInterval("PT".$this->waitingTime."M"); |
|
| 586 | + $tint = new \DateInterval("PT" . $this->waitingTime . "M"); |
|
| 587 | 587 | $tint->invert = 1; |
| 588 | 588 | $tsLimit = $dt->add($tint)->getTimestamp(); |
| 589 | 589 | foreach ($contents as $item) { |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | //& isolated, less than, greater than, quotation marks and apostrophes |
| 82 | 82 | //should be replaced by their html equivalent |
| 83 | 83 | $input = str_replace( |
| 84 | - ['&','<','>','"',"'"], |
|
| 85 | - ['&','<','>','"','''], |
|
| 84 | + ['&', '<', '>', '"', "'"], |
|
| 85 | + ['&', '<', '>', '"', '''], |
|
| 86 | 86 | $input |
| 87 | 87 | ); |
| 88 | 88 | $input = self::normalize($input); |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | public static function squashCharacters($input) |
| 110 | 110 | { |
| 111 | 111 | $input = trim($input); |
| 112 | - $aFind = ['á','à','ã','â','é','ê','í','ó','ô','õ','ö','ú','ü', |
|
| 113 | - 'ç','Á','À','Ã','Â','É','Ê','Í','Ó','Ô','Õ','Ö','Ú','Ü','Ç']; |
|
| 114 | - $aSubs = ['a','a','a','a','e','e','i','o','o','o','o','u','u', |
|
| 115 | - 'c','A','A','A','A','E','E','I','O','O','O','O','U','U','C']; |
|
| 112 | + $aFind = ['á', 'à', 'ã', 'â', 'é', 'ê', 'í', 'ó', 'ô', 'õ', 'ö', 'ú', 'ü', |
|
| 113 | + 'ç', 'Á', 'À', 'Ã', 'Â', 'É', 'Ê', 'Í', 'Ó', 'Ô', 'Õ', 'Ö', 'Ú', 'Ü', 'Ç']; |
|
| 114 | + $aSubs = ['a', 'a', 'a', 'a', 'e', 'e', 'i', 'o', 'o', 'o', 'o', 'u', 'u', |
|
| 115 | + 'c', 'A', 'A', 'A', 'A', 'E', 'E', 'I', 'O', 'O', 'O', 'O', 'U', 'U', 'C']; |
|
| 116 | 116 | return str_replace($aFind, $aSubs, $input); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -126,21 +126,21 @@ discard block |
||
| 126 | 126 | public static function normalize($input) |
| 127 | 127 | { |
| 128 | 128 | //Carriage Return, Tab and Line Feed is not acceptable in strings |
| 129 | - $input = str_replace(["\r","\t","\n"], "", $input); |
|
| 129 | + $input = str_replace(["\r", "\t", "\n"], "", $input); |
|
| 130 | 130 | //Multiple spaces is not acceptable in strings |
| 131 | 131 | $input = preg_replace('/(?:\s\s+)/', ' ', $input); |
| 132 | 132 | //Only UTF-8 characters is acceptable |
| 133 | 133 | $input = Encoding::fixUTF8($input); |
| 134 | 134 | $input = preg_replace( |
| 135 | - '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'. |
|
| 136 | - '|[\x00-\x7F][\x80-\xBF]+'. |
|
| 137 | - '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'. |
|
| 138 | - '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})'. |
|
| 135 | + '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]' . |
|
| 136 | + '|[\x00-\x7F][\x80-\xBF]+' . |
|
| 137 | + '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*' . |
|
| 138 | + '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})' . |
|
| 139 | 139 | '|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/S', |
| 140 | 140 | '', |
| 141 | 141 | $input |
| 142 | 142 | ); |
| 143 | - $input = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'. |
|
| 143 | + $input = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]' . |
|
| 144 | 144 | '|\xED[\xA0-\xBF][\x80-\xBF]/S', '', $input); |
| 145 | 145 | //And no other control character is acceptable either |
| 146 | 146 | return preg_replace('/[[:cntrl:]]/', '', $input); |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | public static function clearProtocoledXML($string) |
| 209 | 209 | { |
| 210 | 210 | $procXML = self::clearXmlString($string); |
| 211 | - $aApp = array('nfe','cte','mdfe'); |
|
| 211 | + $aApp = array('nfe', 'cte', 'mdfe'); |
|
| 212 | 212 | foreach ($aApp as $app) { |
| 213 | 213 | $procXML = str_replace( |
| 214 | - 'xmlns="http://www.portalfiscal.inf.br/'.$app.'" xmlns="http://www.w3.org/2000/09/xmldsig#"', |
|
| 215 | - 'xmlns="http://www.portalfiscal.inf.br/'.$app.'"', |
|
| 214 | + 'xmlns="http://www.portalfiscal.inf.br/' . $app . '" xmlns="http://www.w3.org/2000/09/xmldsig#"', |
|
| 215 | + 'xmlns="http://www.portalfiscal.inf.br/' . $app . '"', |
|
| 216 | 216 | $procXML |
| 217 | 217 | ); |
| 218 | 218 | } |
@@ -227,11 +227,11 @@ discard block |
||
| 227 | 227 | public static function removeSomeAlienCharsfromTxt($txt) |
| 228 | 228 | { |
| 229 | 229 | //remove CRs and TABs |
| 230 | - $txt = str_replace(["\r","\t"], "", $txt); |
|
| 230 | + $txt = str_replace(["\r", "\t"], "", $txt); |
|
| 231 | 231 | //remove multiple spaces |
| 232 | 232 | $txt = preg_replace('/(?:\s\s+)/', ' ', $txt); |
| 233 | 233 | //remove spaces at begin and end of fields |
| 234 | - $txt = str_replace(["| "," |"], "|", $txt); |
|
| 234 | + $txt = str_replace(["| ", " |"], "|", $txt); |
|
| 235 | 235 | return $txt; |
| 236 | 236 | } |
| 237 | 237 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | if (count($par) > 1) { |
| 46 | 46 | //tem mais diretorios |
| 47 | 47 | $dir = ''; |
| 48 | - for ($x = 0; $x < (count($par)-1); $x++) { |
|
| 48 | + for ($x = 0; $x < (count($par) - 1); $x++) { |
|
| 49 | 49 | $dir .= $par[$x] . "/"; |
| 50 | 50 | } |
| 51 | 51 | if (!is_dir($this->path . $dir)) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public function listContents(string $folder = '') |
| 90 | 90 | { |
| 91 | 91 | $new = []; |
| 92 | - if (is_dir($this->path. DIRECTORY_SEPARATOR . $folder)) { |
|
| 92 | + if (is_dir($this->path . DIRECTORY_SEPARATOR . $folder)) { |
|
| 93 | 93 | if (empty($folder)) { |
| 94 | 94 | $list = glob($this->path . "*.*"); |
| 95 | 95 | } else { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | return true; |
| 130 | 130 | } elseif (is_file($path)) { |
| 131 | 131 | return true; |
| 132 | - } elseif (is_file($this->path. DIRECTORY_SEPARATOR . $path)) { |
|
| 132 | + } elseif (is_file($this->path . DIRECTORY_SEPARATOR . $path)) { |
|
| 133 | 133 | return true; |
| 134 | 134 | } |
| 135 | 135 | return false; |
@@ -20,13 +20,13 @@ |
||
| 20 | 20 | public static function digestComparisonFailed() |
| 21 | 21 | { |
| 22 | 22 | return new static('O conteúdo do XML não corresponde ao Digest Value. ' |
| 23 | - . 'Provavelmente foi alterado após ter sido assinado'); |
|
| 23 | + . 'Provavelmente foi alterado após ter sido assinado'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function signatureComparisonFailed() |
| 27 | 27 | { |
| 28 | 28 | return new static('A assinatura do XML não combina. ' |
| 29 | - . 'O conteúdo provavelmente foi alterado após ter sido assinado.'); |
|
| 29 | + . 'O conteúdo provavelmente foi alterado após ter sido assinado.'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
@@ -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('Este XML não é válido. '.$msg); |
|
| 22 | + return new static('Este XML não é válido. ' . $msg); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public static function isNotXml() |
@@ -151,7 +151,7 @@ |
||
| 151 | 151 | */ |
| 152 | 152 | private function getCodeMessage($code) |
| 153 | 153 | { |
| 154 | - $codes = json_decode(file_get_contents(__DIR__.'/httpcodes.json'), true); |
|
| 154 | + $codes = json_decode(file_get_contents(__DIR__ . '/httpcodes.json'), true); |
|
| 155 | 155 | if (!empty($codes[$code])) { |
| 156 | 156 | return $codes[$code]['description']; |
| 157 | 157 | } |