Passed
Push — master ( 051020...3a085f )
by Roberto
04:32 queued 02:24
created
src/Strings.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
         //& isolated, less than, greater than, quotation marks and apostrophes
50 50
         //should be replaced by their html equivalent
51 51
         $input = str_replace(
52
-            ['& ','<','>','"',"'"],
53
-            ['&amp; ','&lt;','&gt;','&quot;','&#39;'],
52
+            ['& ', '<', '>', '"', "'"],
53
+            ['&amp; ', '&lt;', '&gt;', '&quot;', '&#39;'],
54 54
             $input
55 55
         );
56 56
         $input = self::normalize($input);
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
     public static function squashCharacters($input)
78 78
     {
79 79
         $input = trim($input);
80
-        $aFind = ['á','à','ã','â','é','ê','í','ó','ô','õ','ú','ü',
81
-            'ç','Á','À','Ã','Â','É','Ê','Í','Ó','Ô','Õ','Ú','Ü','Ç'];
82
-        $aSubs = ['a','a','a','a','e','e','i','o','o','o','u','u',
83
-            'c','A','A','A','A','E','E','I','O','O','O','U','U','C'];
80
+        $aFind = ['á', 'à', 'ã', 'â', 'é', 'ê', 'í', 'ó', 'ô', 'õ', 'ú', 'ü',
81
+            'ç', 'Á', 'À', 'Ã', 'Â', 'É', 'Ê', 'Í', 'Ó', 'Ô', 'Õ', 'Ú', 'Ü', 'Ç'];
82
+        $aSubs = ['a', 'a', 'a', 'a', 'e', 'e', 'i', 'o', 'o', 'o', 'u', 'u',
83
+            'c', 'A', 'A', 'A', 'A', 'E', 'E', 'I', 'O', 'O', 'O', 'U', 'U', 'C'];
84 84
         return str_replace($aFind, $aSubs, $input);
85 85
     }
86 86
     
@@ -94,21 +94,21 @@  discard block
 block discarded – undo
94 94
     public static function normalize($input)
95 95
     {
96 96
         //Carriage Return, Tab and Line Feed is not acceptable in strings
97
-        $input = str_replace(["\r","\t","\n"], "", $input);
97
+        $input = str_replace(["\r", "\t", "\n"], "", $input);
98 98
         //Multiple spaces is not acceptable in strings
99 99
         $input = preg_replace('/(?:\s\s+)/', ' ', $input);
100 100
         //Only UTF-8 characters is acceptable
101 101
         $input = Encoding::fixUTF8($input);
102 102
         $input = preg_replace(
103
-            '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'.
104
-            '|[\x00-\x7F][\x80-\xBF]+'.
105
-            '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'.
106
-            '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})'.
103
+            '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]' .
104
+            '|[\x00-\x7F][\x80-\xBF]+' .
105
+            '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*' .
106
+            '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})' .
107 107
             '|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/S',
108 108
             '',
109 109
             $input
110 110
         );
111
-        $input = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'.
111
+        $input = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]' .
112 112
             '|\xED[\xA0-\xBF][\x80-\xBF]/S', '', $input);
113 113
         //And no other control character is acceptable either
114 114
         return preg_replace('/[[:cntrl:]]/', '', $input);
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
     public static function clearProtocoledXML($string)
177 177
     {
178 178
         $procXML = self::clearXmlString($string);
179
-        $aApp = array('nfe','cte','mdfe');
179
+        $aApp = array('nfe', 'cte', 'mdfe');
180 180
         foreach ($aApp as $app) {
181 181
             $procXML = str_replace(
182
-                'xmlns="http://www.portalfiscal.inf.br/'.$app.'" xmlns="http://www.w3.org/2000/09/xmldsig#"',
183
-                'xmlns="http://www.portalfiscal.inf.br/'.$app.'"',
182
+                'xmlns="http://www.portalfiscal.inf.br/' . $app . '" xmlns="http://www.w3.org/2000/09/xmldsig#"',
183
+                'xmlns="http://www.portalfiscal.inf.br/' . $app . '"',
184 184
                 $procXML
185 185
             );
186 186
         }
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
     public static function removeSomeAlienCharsfromTxt($txt)
196 196
     {
197 197
         //remove CRs and TABs
198
-        $txt = str_replace(["\r","\t"], "", $txt);
198
+        $txt = str_replace(["\r", "\t"], "", $txt);
199 199
         //remove multiple spaces
200 200
         $txt = preg_replace('/(?:\s\s+)/', ' ', $txt);
201 201
         //remove spaces at begin and end of fields
202
-        $txt = str_replace(["| "," |"], "|", $txt);
202
+        $txt = str_replace(["| ", " |"], "|", $txt);
203 203
         return $txt;
204 204
     }
205 205
     
Please login to merge, or discard this patch.