Test Failed
Push — master ( c15d53...e7a44f )
by Roberto
02:16
created
src/Strings.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
         //& isolated, less than, greater than, quotation marks and apostrophes
83 83
         //should be replaced by their html equivalent
84 84
         $input = str_replace(
85
-            ['& ','<','>','"',"'"],
86
-            ['&amp; ','&lt; ','&gt; ','&quot; ','&#39; '],
85
+            ['& ', '<', '>', '"', "'"],
86
+            ['&amp; ', '&lt; ', '&gt; ', '&quot; ', '&#39; '],
87 87
             $input
88 88
         );
89 89
         $input = self::normalize($input);
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
     public static function squashCharacters($input)
111 111
     {
112 112
         $input = trim($input);
113
-        $aFind = ['á','à','ã','â','é','ê','í','ó','ô','õ','ö','ú','ü',
114
-            'ç','Á','À','Ã','Â','É','Ê','Í','Ó','Ô','Õ','Ö','Ú','Ü','Ç'];
115
-        $aSubs = ['a','a','a','a','e','e','i','o','o','o','o','u','u',
116
-            'c','A','A','A','A','E','E','I','O','O','O','O','U','U','C'];
113
+        $aFind = ['á', 'à', 'ã', 'â', 'é', 'ê', 'í', 'ó', 'ô', 'õ', 'ö', 'ú', 'ü',
114
+            'ç', 'Á', 'À', 'Ã', 'Â', 'É', 'Ê', 'Í', 'Ó', 'Ô', 'Õ', 'Ö', 'Ú', 'Ü', 'Ç'];
115
+        $aSubs = ['a', 'a', 'a', 'a', 'e', 'e', 'i', 'o', 'o', 'o', 'o', 'u', 'u',
116
+            'c', 'A', 'A', 'A', 'A', 'E', 'E', 'I', 'O', 'O', 'O', 'O', 'U', 'U', 'C'];
117 117
         return str_replace($aFind, $aSubs, $input);
118 118
     }
119 119
     
@@ -127,21 +127,21 @@  discard block
 block discarded – undo
127 127
     public static function normalize($input)
128 128
     {
129 129
         //Carriage Return, Tab and Line Feed is not acceptable in strings
130
-        $input = str_replace(["\r","\t","\n"], "", $input);
130
+        $input = str_replace(["\r", "\t", "\n"], "", $input);
131 131
         //Multiple spaces is not acceptable in strings
132 132
         $input = preg_replace('/(?:\s\s+)/', ' ', $input);
133 133
         //Only UTF-8 characters is acceptable
134 134
         $input = Encoding::fixUTF8($input);
135 135
         $input = preg_replace(
136
-            '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'.
137
-            '|[\x00-\x7F][\x80-\xBF]+'.
138
-            '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'.
139
-            '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})'.
136
+            '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]' .
137
+            '|[\x00-\x7F][\x80-\xBF]+' .
138
+            '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*' .
139
+            '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})' .
140 140
             '|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/S',
141 141
             '',
142 142
             $input
143 143
         );
144
-        $input = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'.
144
+        $input = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]' .
145 145
             '|\xED[\xA0-\xBF][\x80-\xBF]/S', '', $input);
146 146
         //And no other control character is acceptable either
147 147
         return preg_replace('/[[:cntrl:]]/', '', $input);
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
     public static function clearProtocoledXML($string)
210 210
     {
211 211
         $procXML = self::clearXmlString($string);
212
-        $aApp = array('nfe','cte','mdfe');
212
+        $aApp = array('nfe', 'cte', 'mdfe');
213 213
         foreach ($aApp as $app) {
214 214
             $procXML = str_replace(
215
-                'xmlns="http://www.portalfiscal.inf.br/'.$app.'" xmlns="http://www.w3.org/2000/09/xmldsig#"',
216
-                'xmlns="http://www.portalfiscal.inf.br/'.$app.'"',
215
+                'xmlns="http://www.portalfiscal.inf.br/' . $app . '" xmlns="http://www.w3.org/2000/09/xmldsig#"',
216
+                'xmlns="http://www.portalfiscal.inf.br/' . $app . '"',
217 217
                 $procXML
218 218
             );
219 219
         }
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
     public static function removeSomeAlienCharsfromTxt($txt)
229 229
     {
230 230
         //remove CRs and TABs
231
-        $txt = str_replace(["\r","\t"], "", $txt);
231
+        $txt = str_replace(["\r", "\t"], "", $txt);
232 232
         //remove multiple spaces
233 233
         $txt = preg_replace('/(?:\s\s+)/', ' ', $txt);
234 234
         //remove spaces at begin and end of fields
235
-        $txt = str_replace(["| "," |"], "|", $txt);
235
+        $txt = str_replace(["| ", " |"], "|", $txt);
236 236
         return $txt;
237 237
     }
238 238
     
Please login to merge, or discard this patch.