Passed
Push — master ( 6ea7df...684bcb )
by Sebastian
03:24
created
src/ConvertHelper/EOL.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
     const TYPE_LF = 'LF';
30 30
     const TYPE_CR = 'CR';
31 31
     
32
-   /**
33
-    * @var string
34
-    */
32
+    /**
33
+     * @var string
34
+     */
35 35
     protected $char;
36 36
     
37
-   /**
38
-    * @var string
39
-    */
37
+    /**
38
+     * @var string
39
+     */
40 40
     protected $type;
41 41
     
42
-   /**
43
-    * @var string
44
-    */
42
+    /**
43
+     * @var string
44
+     */
45 45
     protected $description;
46 46
 
47 47
     /**
@@ -56,33 +56,33 @@  discard block
 block discarded – undo
56 56
         $this->description = $description;
57 57
     }
58 58
     
59
-   /**
60
-    * The actual EOL character.
61
-    * @return string
62
-    */
59
+    /**
60
+     * The actual EOL character.
61
+     * @return string
62
+     */
63 63
     public function getCharacter() : string
64 64
     {
65 65
         return $this->char;
66 66
     }
67 67
     
68
-   /**
69
-    * A more detailed, human readable description of the character.
70
-    * @return string
71
-    */
68
+    /**
69
+     * A more detailed, human readable description of the character.
70
+     * @return string
71
+     */
72 72
     public function getDescription() : string
73 73
     {
74 74
         return $this->description;
75 75
     }
76 76
     
77
-   /**
78
-    * The EOL character type, e.g. "CR+LF", "CR"...
79
-    * @return string
80
-    * 
81
-    * @see ConvertHelper_EOL::TYPE_CR
82
-    * @see ConvertHelper_EOL::TYPE_CRLF
83
-    * @see ConvertHelper_EOL::TYPE_LF
84
-    * @see ConvertHelper_EOL::TYPE_LFCR
85
-    */
77
+    /**
78
+     * The EOL character type, e.g. "CR+LF", "CR"...
79
+     * @return string
80
+     * 
81
+     * @see ConvertHelper_EOL::TYPE_CR
82
+     * @see ConvertHelper_EOL::TYPE_CRLF
83
+     * @see ConvertHelper_EOL::TYPE_LF
84
+     * @see ConvertHelper_EOL::TYPE_LFCR
85
+     */
86 86
     public function getType() : string
87 87
     {
88 88
         return $this->type;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     public static function detect(string $subjectString) : ?ConvertHelper_EOL
123 123
     {
124
-        if(empty($subjectString)) {
124
+        if (empty($subjectString)) {
125 125
             return null;
126 126
         }
127 127
 
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
         $results = array();
130 130
         $chars = self::getEOLChars();
131 131
 
132
-        foreach($chars as $def)
132
+        foreach ($chars as $def)
133 133
         {
134 134
             $amount = substr_count($subjectString, $def['char']);
135 135
 
136
-            if($amount > $max)
136
+            if ($amount > $max)
137 137
             {
138 138
                 $max = $amount;
139 139
                 $results[] = $def;
140 140
             }
141 141
         }
142 142
 
143
-        if(empty($results)) {
143
+        if (empty($results)) {
144 144
             return null;
145 145
         }
146 146
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public static function getEOLChars() : array
158 158
     {
159
-        if(isset(self::$eolChars)) {
159
+        if (isset(self::$eolChars)) {
160 160
             return self::$eolChars;
161 161
         }
162 162
 
Please login to merge, or discard this patch.
src/ConvertHelper/String.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
      * @param bool $caseInsensitive
20 20
      * @return ConvertHelper_StringMatch[]
21 21
      */
22
-    public static function findString(string $needle, string $haystack, bool $caseInsensitive=false): array
22
+    public static function findString(string $needle, string $haystack, bool $caseInsensitive = false): array
23 23
     {
24
-        if($needle === '') {
24
+        if ($needle === '') {
25 25
             return array();
26 26
         }
27 27
 
28 28
         $function = 'mb_strpos';
29
-        if($caseInsensitive) {
29
+        if ($caseInsensitive) {
30 30
             $function = 'mb_stripos';
31 31
         }
32 32
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $positions = array();
35 35
         $length = mb_strlen($needle);
36 36
 
37
-        while( ($pos = $function($haystack, $needle, $pos)) !== false)
37
+        while (($pos = $function($haystack, $needle, $pos)) !== false)
38 38
         {
39 39
             $match = mb_substr($haystack, $pos, $length);
40 40
             $positions[] = new ConvertHelper_StringMatch($pos, $match);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     public static function toArray(string $string) : array
58 58
     {
59 59
         $result = preg_split('//u', $string, 0, PREG_SPLIT_NO_EMPTY);
60
-        if($result !== false) {
60
+        if ($result !== false) {
61 61
             return $result;
62 62
         }
63 63
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public static function toUtf8(string $string) : string
112 112
     {
113
-        if(!self::isASCII($string)) {
113
+        if (!self::isASCII($string)) {
114 114
             return Encoding::toUTF8($string);
115 115
         }
116 116
 
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public static function isASCII($string) : bool
130 130
     {
131
-        if($string === '' || $string === NULL) {
131
+        if ($string === '' || $string === NULL) {
132 132
             return true;
133 133
         }
134 134
 
135
-        if(!is_string($string)) {
135
+        if (!is_string($string)) {
136 136
             return false;
137 137
         }
138 138
 
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public static function isHTML(string $string) : bool
149 149
     {
150
-        if(preg_match('%<[a-z/][\s\S]*>%siU', $string)) {
150
+        if (preg_match('%<[a-z/][\s\S]*>%siU', $string)) {
151 151
             return true;
152 152
         }
153 153
 
154 154
         $decoded = html_entity_decode($string);
155
-        if($decoded !== $string) {
155
+        if ($decoded !== $string) {
156 156
             return true;
157 157
         }
158 158
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      * @param int $tabSize The amount of spaces per tab.
185 185
      * @return string
186 186
      */
187
-    public static function tabs2spaces(string $string, int $tabSize=4) : string
187
+    public static function tabs2spaces(string $string, int $tabSize = 4) : string
188 188
     {
189 189
         return str_replace("\t", str_repeat(' ', $tabSize), $string);
190 190
     }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      * @param int $tabSize The amount of spaces per tab in the source string.
197 197
      * @return string
198 198
      */
199
-    public static function spaces2tabs(string $string, int $tabSize=4) : string
199
+    public static function spaces2tabs(string $string, int $tabSize = 4) : string
200 200
     {
201 201
         return str_replace(str_repeat(' ', $tabSize), "\t", $string);
202 202
     }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
             return $text;
274 274
         }
275 275
 
276
-        $text = trim(mb_substr($text, 0, $targetLength)) . $append;
276
+        $text = trim(mb_substr($text, 0, $targetLength)).$append;
277 277
 
278 278
         return $text;
279 279
     }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
      */
289 289
     public static function explodeTrim(string $delimiter, string $string) : array
290 290
     {
291
-        if(empty($string) || empty($delimiter)) {
291
+        if (empty($string) || empty($delimiter)) {
292 292
             return array();
293 293
         }
294 294
 
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
         $tokens = array_map('trim', $tokens);
297 297
 
298 298
         $keep = array();
299
-        foreach($tokens as $token) {
300
-            if($token !== '') {
299
+        foreach ($tokens as $token) {
300
+            if ($token !== '') {
301 301
                 $keep[] = $token;
302 302
             }
303 303
         }
Please login to merge, or discard this patch.