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