@@ -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 |