@@ -194,8 +194,8 @@ |
||
194 | 194 | $mdec = strpos($n[1], '-'); |
195 | 195 | $p = explode('.', $value); |
196 | 196 | |
197 | - $ndec = !empty($p[1]) ? strlen($p[1]) : 0;//decimal digits |
|
198 | - $nint = strlen($p[0]);//integer digits |
|
197 | + $ndec = !empty($p[1]) ? strlen($p[1]) : 0; //decimal digits |
|
198 | + $nint = strlen($p[0]); //integer digits |
|
199 | 199 | if ($nint > $n[0]) { |
200 | 200 | throw new \InvalidArgumentException("O numero é maior que o permitido [$format]."); |
201 | 201 | } |
@@ -10,6 +10,6 @@ |
||
10 | 10 | public function __construct(Certificate $certificate) |
11 | 11 | { |
12 | 12 | $invalidDate = $certificate->getValidTo()->format('Y-m-d H:i:s'); |
13 | - parent::__construct('Certificate era válido até '.$invalidDate, 0, null); |
|
13 | + parent::__construct('Certificate era válido até ' . $invalidDate, 0, null); |
|
14 | 14 | } |
15 | 15 | } |
@@ -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) { |
@@ -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; |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | //& isolated, less than, greater than, quotation marks and apostrophes |
84 | 84 | //should be replaced by their html equivalent |
85 | 85 | $input = str_replace( |
86 | - ['&','<','>','"',"'"], |
|
87 | - ['&','<','>','"','''], |
|
86 | + ['&', '<', '>', '"', "'"], |
|
87 | + ['&', '<', '>', '"', '''], |
|
88 | 88 | $input |
89 | 89 | ); |
90 | 90 | $input = self::normalize($input); |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | public static function squashCharacters($input) |
112 | 112 | { |
113 | 113 | $input = trim($input); |
114 | - $aFind = ['á','à','ã','â','é','ê','í','ó','ô','õ','ö','ú','ü', |
|
115 | - 'ç','Á','À','Ã','Â','É','Ê','Í','Ó','Ô','Õ','Ö','Ú','Ü','Ç']; |
|
116 | - $aSubs = ['a','a','a','a','e','e','i','o','o','o','o','u','u', |
|
117 | - 'c','A','A','A','A','E','E','I','O','O','O','O','U','U','C']; |
|
114 | + $aFind = ['á', 'à', 'ã', 'â', 'é', 'ê', 'í', 'ó', 'ô', 'õ', 'ö', 'ú', 'ü', |
|
115 | + 'ç', 'Á', 'À', 'Ã', 'Â', 'É', 'Ê', 'Í', 'Ó', 'Ô', 'Õ', 'Ö', 'Ú', 'Ü', 'Ç']; |
|
116 | + $aSubs = ['a', 'a', 'a', 'a', 'e', 'e', 'i', 'o', 'o', 'o', 'o', 'u', 'u', |
|
117 | + 'c', 'A', 'A', 'A', 'A', 'E', 'E', 'I', 'O', 'O', 'O', 'O', 'U', 'U', 'C']; |
|
118 | 118 | return str_replace($aFind, $aSubs, $input); |
119 | 119 | } |
120 | 120 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | public static function normalize($input) |
129 | 129 | { |
130 | 130 | //Carriage Return, Tab and Line Feed is not acceptable in strings |
131 | - $input = str_replace(["\r","\t","\n"], "", $input); |
|
131 | + $input = str_replace(["\r", "\t", "\n"], "", $input); |
|
132 | 132 | //remove aspas simples |
133 | 133 | $input = str_replace("'", '', $input); |
134 | 134 | //remove aspas duplas |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | //Only UTF-8 characters is acceptable |
141 | 141 | $input = Encoding::fixUTF8($input); |
142 | 142 | $input = preg_replace( |
143 | - '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'. |
|
144 | - '|[\x00-\x7F][\x80-\xBF]+'. |
|
145 | - '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'. |
|
146 | - '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})'. |
|
143 | + '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]' . |
|
144 | + '|[\x00-\x7F][\x80-\xBF]+' . |
|
145 | + '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*' . |
|
146 | + '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})' . |
|
147 | 147 | '|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/S', |
148 | 148 | '', |
149 | 149 | $input |
150 | 150 | ); |
151 | - $input = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'. |
|
151 | + $input = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]' . |
|
152 | 152 | '|\xED[\xA0-\xBF][\x80-\xBF]/S', '', $input); |
153 | 153 | //And no other control character is acceptable either |
154 | 154 | return preg_replace('/[[:cntrl:]]/', '', $input); |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | public static function clearProtocoledXML($string) |
217 | 217 | { |
218 | 218 | $procXML = self::clearXmlString($string); |
219 | - $aApp = array('nfe','cte','mdfe'); |
|
219 | + $aApp = array('nfe', 'cte', 'mdfe'); |
|
220 | 220 | foreach ($aApp as $app) { |
221 | 221 | $procXML = str_replace( |
222 | - 'xmlns="http://www.portalfiscal.inf.br/'.$app.'" xmlns="http://www.w3.org/2000/09/xmldsig#"', |
|
223 | - 'xmlns="http://www.portalfiscal.inf.br/'.$app.'"', |
|
222 | + 'xmlns="http://www.portalfiscal.inf.br/' . $app . '" xmlns="http://www.w3.org/2000/09/xmldsig#"', |
|
223 | + 'xmlns="http://www.portalfiscal.inf.br/' . $app . '"', |
|
224 | 224 | $procXML |
225 | 225 | ); |
226 | 226 | } |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | public static function removeSomeAlienCharsfromTxt($txt) |
236 | 236 | { |
237 | 237 | //remove CRs and TABs |
238 | - $txt = str_replace(["\r","\t"], "", $txt); |
|
238 | + $txt = str_replace(["\r", "\t"], "", $txt); |
|
239 | 239 | //remove multiple spaces |
240 | 240 | $txt = preg_replace('/(?:\s\s+)/', ' ', $txt); |
241 | 241 | //remove spaces at begin and end of fields |
242 | - $txt = str_replace(["| "," |"], "|", $txt); |
|
242 | + $txt = str_replace(["| ", " |"], "|", $txt); |
|
243 | 243 | return $txt; |
244 | 244 | } |
245 | 245 |