GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 24a3f9...172650 )
by Brad
02:16
created
src/Methods/Misc.php 2 patches
Spacing   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -66,16 +66,14 @@  discard block
 block discarded – undo
66 66
     {
67 67
         if ($index > $this->getLength()) throw new \OutOfBoundsException();
68 68
 
69
-        $start = UTF8::substr
70
-        (
69
+        $start = UTF8::substr(
71 70
             $this->scalarString,
72 71
             0,
73 72
             $index,
74 73
             $this->encoding
75 74
         );
76 75
 
77
-        $end = UTF8::substr
78
-        (
76
+        $end = UTF8::substr(
79 77
             $this->scalarString,
80 78
             $index,
81 79
             $this->getLength(),
@@ -104,8 +102,7 @@  discard block
 block discarded – undo
104 102
      */
105 103
     public function repeat($multiplier)
106 104
     {
107
-        return $this->newSelf
108
-        (
105
+        return $this->newSelf(
109 106
             UTF8::str_repeat($this->scalarString, $multiplier)
110 107
         );
111 108
     }
@@ -163,8 +160,7 @@  discard block
 block discarded – undo
163 160
             $length = $end - $start;
164 161
         }
165 162
 
166
-        return $this->newSelf
167
-        (
163
+        return $this->newSelf(
168 164
             UTF8::substr($this->scalarString, $start, $length, $this->encoding)
169 165
         );
170 166
     }
@@ -179,8 +175,7 @@  discard block
 block discarded – undo
179 175
      */
180 176
     public function surround($substring)
181 177
     {
182
-        return $this->newSelf
183
-        (
178
+        return $this->newSelf(
184 179
             implode('', [$substring, $this->scalarString, $substring])
185 180
         );
186 181
     }
@@ -213,8 +208,7 @@  discard block
 block discarded – undo
213 208
     {
214 209
         if ($caseSensitive)
215 210
         {
216
-            return UTF8::substr_count
217
-            (
211
+            return UTF8::substr_count(
218 212
                 $this->scalarString,
219 213
                 $substring,
220 214
                 $this->encoding
Please login to merge, or discard this patch.
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -64,7 +64,9 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function insert($substring, $index)
66 66
     {
67
-        if ($index > $this->getLength()) throw new \OutOfBoundsException();
67
+        if ($index > $this->getLength()) {
68
+            throw new \OutOfBoundsException();
69
+        }
68 70
 
69 71
         $start = UTF8::substr
70 72
         (
@@ -149,16 +151,13 @@  discard block
 block discarded – undo
149 151
         if ($end === null)
150 152
         {
151 153
             $length = $this->getLength();
152
-        }
153
-        elseif ($end >= 0 && $end <= $start)
154
+        } elseif ($end >= 0 && $end <= $start)
154 155
         {
155 156
             return $this->newSelf('');
156
-        }
157
-        elseif ($end < 0)
157
+        } elseif ($end < 0)
158 158
         {
159 159
             $length = $this->getLength() + $end - $start;
160
-        }
161
-        else
160
+        } else
162 161
         {
163 162
             $length = $end - $start;
164 163
         }
Please login to merge, or discard this patch.
src/Methods/Between.php 2 patches
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,7 @@
 block discarded – undo
42 42
         $endIndex = $this->indexOf($end, $substrIndex);
43 43
         if ($endIndex === false) return $this->newSelf('');
44 44
 
45
-        $result = UTF8::substr
46
-        (
45
+        $result = UTF8::substr(
47 46
             $this->scalarString,
48 47
             $substrIndex,
49 48
             $endIndex - $substrIndex,
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,12 +35,16 @@  discard block
 block discarded – undo
35 35
     public function between($start, $end, $offset = 0, $include = false)
36 36
     {
37 37
         $startIndex = $this->indexOf($start, $offset);
38
-        if ($startIndex === false) return $this->newSelf('');
38
+        if ($startIndex === false) {
39
+            return $this->newSelf('');
40
+        }
39 41
 
40 42
         $substrIndex = $startIndex + UTF8::strlen($start, $this->encoding);
41 43
 
42 44
         $endIndex = $this->indexOf($end, $substrIndex);
43
-        if ($endIndex === false) return $this->newSelf('');
45
+        if ($endIndex === false) {
46
+            return $this->newSelf('');
47
+        }
44 48
 
45 49
         $result = UTF8::substr
46 50
         (
@@ -50,7 +54,9 @@  discard block
 block discarded – undo
50 54
             $this->encoding
51 55
         );
52 56
 
53
-        if ($include === true) $result = $start.$result.$end;
57
+        if ($include === true) {
58
+            $result = $start.$result.$end;
59
+        }
54 60
 
55 61
         return $this->newSelf($result);
56 62
     }
Please login to merge, or discard this patch.
src/Methods/To.php 3 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -15,27 +15,27 @@  discard block
 block discarded – undo
15 15
 
16 16
 trait To
17 17
 {
18
-	/**
19
-	 * Explicitly turn Str back into a scalar string.
20
-	 *
21
-	 * @return string
22
-	 */
23
-	public function toString()
24
-	{
25
-		return $this->__toString();
26
-	}
18
+    /**
19
+     * Explicitly turn Str back into a scalar string.
20
+     *
21
+     * @return string
22
+     */
23
+    public function toString()
24
+    {
25
+        return $this->__toString();
26
+    }
27 27
 
28 28
     /**
29
-	 * Converts the string to an array of characters.
30
-	 *
31
-	 * Each character is an instance of Str.
32
-	 *
33
-	 * @return static[]
34
-	 */
35
-	public function toArray()
36
-	{
37
-		return $this->getIterator()->getArrayCopy();
38
-	}
29
+     * Converts the string to an array of characters.
30
+     *
31
+     * Each character is an instance of Str.
32
+     *
33
+     * @return static[]
34
+     */
35
+    public function toArray()
36
+    {
37
+        return $this->getIterator()->getArrayCopy();
38
+    }
39 39
 
40 40
     /**
41 41
      * Converts all characters in the string to lowercase.
@@ -72,19 +72,19 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function toSingular($language = 'en')
74 74
     {
75
-		if (!class_exists('\\ICanBoogie\\Inflector'))
76
-		{
77
-			throw new \RuntimeException
78
-			(
79
-				"This method requires ICanBoogie\Inflector. ".
80
-				"Install with: composer require icanboogie/inflector"
81
-			);
82
-		}
75
+        if (!class_exists('\\ICanBoogie\\Inflector'))
76
+        {
77
+            throw new \RuntimeException
78
+            (
79
+                "This method requires ICanBoogie\Inflector. ".
80
+                "Install with: composer require icanboogie/inflector"
81
+            );
82
+        }
83 83
 
84 84
         return $this->newSelf
85 85
         (
86 86
             \ICanBoogie\Inflector::get($language)
87
-			->singularize($this->scalarString)
87
+            ->singularize($this->scalarString)
88 88
         );
89 89
     }
90 90
 
@@ -97,19 +97,19 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function toPlural($language = 'en')
99 99
     {
100
-		if (!class_exists('\\ICanBoogie\\Inflector'))
101
-		{
102
-			throw new \RuntimeException
103
-			(
104
-				"This method requires ICanBoogie\Inflector. ".
105
-				"Install with: composer require icanboogie/inflector"
106
-			);
107
-		}
100
+        if (!class_exists('\\ICanBoogie\\Inflector'))
101
+        {
102
+            throw new \RuntimeException
103
+            (
104
+                "This method requires ICanBoogie\Inflector. ".
105
+                "Install with: composer require icanboogie/inflector"
106
+            );
107
+        }
108 108
 
109 109
         return $this->newSelf
110 110
         (
111 111
             \ICanBoogie\Inflector::get($language)
112
-			->pluralize($this->scalarString)
112
+            ->pluralize($this->scalarString)
113 113
         );
114 114
     }
115 115
 
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         return $this->trim()->toLowerCase()->upperCaseFirst();
396 396
     }
397 397
 
398
-	/**
398
+    /**
399 399
      * Converts the string into an URL slug.
400 400
      *
401 401
      * This includes replacing non-ASCII characters with their closest ASCII
@@ -413,24 +413,24 @@  discard block
 block discarded – undo
413 413
      */
414 414
     public function toSlugCase($replacement = '-', $language = 'en', $strToLower = true)
415 415
     {
416
-		if (!class_exists('\\voku\\helper\\URLify'))
417
-		{
418
-			throw new \RuntimeException
419
-			(
420
-				"This method requires \voku\helper\URLify. ".
421
-				"Install with: composer require voku/urlify"
422
-			);
423
-		}
416
+        if (!class_exists('\\voku\\helper\\URLify'))
417
+        {
418
+            throw new \RuntimeException
419
+            (
420
+                "This method requires \voku\helper\URLify. ".
421
+                "Install with: composer require voku/urlify"
422
+            );
423
+        }
424 424
 
425 425
         return $this->newSelf
426 426
         (
427 427
             \voku\helper\URLify::slug
428
-			(
429
-				$this->scalarString,
430
-				$language,
431
-				$replacement,
432
-				$strToLower
433
-			)
428
+            (
429
+                $this->scalarString,
430
+                $language,
431
+                $replacement,
432
+                $strToLower
433
+            )
434 434
         );
435 435
     }
436 436
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -46 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function toLowerCase()
46 46
     {
47
-        return $this->newSelf
48
-        (
47
+        return $this->newSelf(
49 48
             UTF8::strtolower($this->scalarString, $this->encoding)
50 49
         );
51 50
     }
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
      */
58 57
     public function toUpperCase()
59 58
     {
60
-        return $this->newSelf
61
-        (
59
+        return $this->newSelf(
62 60
             UTF8::strtoupper($this->scalarString, $this->encoding)
63 61
         );
64 62
     }
@@ -74,15 +72,13 @@  discard block
 block discarded – undo
74 72
     {
75 73
 		if (!class_exists('\\ICanBoogie\\Inflector'))
76 74
 		{
77
-			throw new \RuntimeException
78
-			(
75
+			throw new \RuntimeException(
79 76
 				"This method requires ICanBoogie\Inflector. ".
80 77
 				"Install with: composer require icanboogie/inflector"
81 78
 			);
82 79
 		}
83 80
 
84
-        return $this->newSelf
85
-        (
81
+        return $this->newSelf(
86 82
             \ICanBoogie\Inflector::get($language)
87 83
 			->singularize($this->scalarString)
88 84
         );
@@ -99,15 +95,13 @@  discard block
 block discarded – undo
99 95
     {
100 96
 		if (!class_exists('\\ICanBoogie\\Inflector'))
101 97
 		{
102
-			throw new \RuntimeException
103
-			(
98
+			throw new \RuntimeException(
104 99
 				"This method requires ICanBoogie\Inflector. ".
105 100
 				"Install with: composer require icanboogie/inflector"
106 101
 			);
107 102
 		}
108 103
 
109
-        return $this->newSelf
110
-        (
104
+        return $this->newSelf(
111 105
             \ICanBoogie\Inflector::get($language)
112 106
 			->pluralize($this->scalarString)
113 107
         );
@@ -123,8 +117,7 @@  discard block
 block discarded – undo
123 117
      */
124 118
     public function toAscii()
125 119
     {
126
-        return $this->newSelf
127
-        (
120
+        return $this->newSelf(
128 121
             UTF8::toAscii($this->scalarString)
129 122
         );
130 123
     }
@@ -184,10 +177,8 @@  discard block
 block discarded – undo
184 177
      */
185 178
     public function toSpaces($tabLength = 4)
186 179
     {
187
-        return $this->newSelf
188
-        (
189
-            UTF8::str_replace
190
-            (
180
+        return $this->newSelf(
181
+            UTF8::str_replace(
191 182
                 "\t",
192 183
                 UTF8::str_repeat(' ', $tabLength),
193 184
                 $this->scalarString
@@ -208,10 +199,8 @@  discard block
 block discarded – undo
208 199
      */
209 200
     public function toTabs($tabLength = 4)
210 201
     {
211
-        return $this->newSelf
212
-        (
213
-            UTF8::str_replace
214
-            (
202
+        return $this->newSelf(
203
+            UTF8::str_replace(
215 204
                 UTF8::str_repeat(' ', $tabLength),
216 205
                 "\t",
217 206
                 $this->scalarString
@@ -263,10 +252,9 @@  discard block
 block discarded – undo
263 252
 
264 253
         $camelCase = preg_replace('/^[-_]+/', '', (string)$camelCase);
265 254
 
266
-        $camelCase = preg_replace_callback
267
-        (
255
+        $camelCase = preg_replace_callback(
268 256
             '/[-_\s]+(.)?/u',
269
-            function ($match)
257
+            function($match)
270 258
             {
271 259
                 if (isset($match[1]))
272 260
                 {
@@ -280,10 +268,9 @@  discard block
 block discarded – undo
280 268
             $camelCase
281 269
         );
282 270
 
283
-        $camelCase = preg_replace_callback
284
-        (
271
+        $camelCase = preg_replace_callback(
285 272
             '/[\d]+(.)?/u',
286
-            function ($match)
273
+            function($match)
287 274
             {
288 275
                 return UTF8::strtoupper($match[0], $this->encoding);
289 276
             },
@@ -308,31 +295,29 @@  discard block
 block discarded – undo
308 295
 
309 296
         $snake = str_replace('-', '_', $snake);
310 297
 
311
-        $snake = preg_replace_callback
312
-        (
298
+        $snake = preg_replace_callback(
313 299
             '/([\d|A-Z])/u',
314
-            function ($matches)
300
+            function($matches)
315 301
             {
316 302
                 $match = $matches[1];
317 303
                 $matchInt = (int)$match;
318 304
 
319 305
                 if ("$matchInt" == $match)
320 306
                 {
321
-                    return '_' . $match . '_';
307
+                    return '_'.$match.'_';
322 308
                 }
323 309
                 else
324 310
                 {
325
-                    return '_' . UTF8::strtolower($match, $this->encoding);
311
+                    return '_'.UTF8::strtolower($match, $this->encoding);
326 312
                 }
327 313
             },
328 314
             $snake
329 315
         );
330 316
 
331
-        $snake = preg_replace
332
-        (
317
+        $snake = preg_replace(
333 318
             [
334
-                '/\s+/',        // convert spaces to "_"
335
-                '/^\s+|\s+$/',  // trim leading & trailing spaces
319
+                '/\s+/', // convert spaces to "_"
320
+                '/^\s+|\s+$/', // trim leading & trailing spaces
336 321
                 '/_+/'          // remove double "_"
337 322
             ],
338 323
             [
@@ -364,10 +349,9 @@  discard block
 block discarded – undo
364 349
      */
365 350
     public function toTitleCase($ignore = null)
366 351
     {
367
-        return $this->newSelf(preg_replace_callback
368
-        (
352
+        return $this->newSelf(preg_replace_callback(
369 353
             '/([\S]+)/u',
370
-            function ($match) use ($ignore)
354
+            function($match) use ($ignore)
371 355
             {
372 356
                 if ($ignore && in_array($match[0], $ignore, true))
373 357
                 {
@@ -415,17 +399,14 @@  discard block
 block discarded – undo
415 399
     {
416 400
 		if (!class_exists('\\voku\\helper\\URLify'))
417 401
 		{
418
-			throw new \RuntimeException
419
-			(
402
+			throw new \RuntimeException(
420 403
 				"This method requires \voku\helper\URLify. ".
421 404
 				"Install with: composer require voku/urlify"
422 405
 			);
423 406
 		}
424 407
 
425
-        return $this->newSelf
426
-        (
427
-            \voku\helper\URLify::slug
428
-			(
408
+        return $this->newSelf(
409
+            \voku\helper\URLify::slug(
429 410
 				$this->scalarString,
430 411
 				$language,
431 412
 				$replacement,
Please login to merge, or discard this patch.
Braces   +8 added lines, -11 removed lines patch added patch discarded remove patch
@@ -160,12 +160,10 @@  discard block
 block discarded – undo
160 160
         if (array_key_exists($key, $map))
161 161
         {
162 162
             return $map[$key];
163
-        }
164
-        elseif (is_numeric($this->scalarString))
163
+        } elseif (is_numeric($this->scalarString))
165 164
         {
166 165
             return ((int)$this->scalarString > 0);
167
-        }
168
-        else
166
+        } else
169 167
         {
170 168
             return (bool)$this->regexReplace('[[:space:]]', '')->scalarString;
171 169
         }
@@ -271,8 +269,7 @@  discard block
 block discarded – undo
271 269
                 if (isset($match[1]))
272 270
                 {
273 271
                     return UTF8::strtoupper($match[1], $this->encoding);
274
-                }
275
-                else
272
+                } else
276 273
                 {
277 274
                     return '';
278 275
                 }
@@ -292,7 +289,9 @@  discard block
 block discarded – undo
292 289
 
293 290
         $camelCase = $this->newSelf($camelCase);
294 291
 
295
-        if ($upperFirst === true) $camelCase = $camelCase->upperCaseFirst();
292
+        if ($upperFirst === true) {
293
+            $camelCase = $camelCase->upperCaseFirst();
294
+        }
296 295
 
297 296
         return $camelCase;
298 297
     }
@@ -319,8 +318,7 @@  discard block
 block discarded – undo
319 318
                 if ("$matchInt" == $match)
320 319
                 {
321 320
                     return '_' . $match . '_';
322
-                }
323
-                else
321
+                } else
324 322
                 {
325 323
                     return '_' . UTF8::strtolower($match, $this->encoding);
326 324
                 }
@@ -372,8 +370,7 @@  discard block
 block discarded – undo
372 370
                 if ($ignore && in_array($match[0], $ignore, true))
373 371
                 {
374 372
                     return $match[0];
375
-                }
376
-                else
373
+                } else
377 374
                 {
378 375
                     return (string)$this->newSelf($match[0])
379 376
                     ->toLowerCase()->upperCaseFirst();
Please login to merge, or discard this patch.
src/Methods/FirstLast.php 1 patch
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
         if ($n > 0)
30 30
         {
31
-            $first = UTF8::substr
32
-            (
31
+            $first = UTF8::substr(
33 32
                 $this->scalarString,
34 33
                 0,
35 34
                 $n,
@@ -53,8 +52,7 @@  discard block
 block discarded – undo
53 52
 
54 53
         if ($n > 0)
55 54
         {
56
-            $last = UTF8::substr
57
-            (
55
+            $last = UTF8::substr(
58 56
                 $this->scalarString,
59 57
                 -$n,
60 58
                 null,
Please login to merge, or discard this patch.
src/Methods/IndexOf.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -16,49 +16,49 @@
 block discarded – undo
16 16
 trait IndexOf
17 17
 {
18 18
     /**
19
-	 * Returns the index of the first occurrence of $needle in the string,
20
-	 * and false if not found. Accepts an optional offset from which to begin
21
-	 * the search.
22
-	 *
23
-	 * @param  string   $needle Substring to look for.
24
-	 *
25
-	 * @param  int      $offset Offset from which to search.
26
-	 *
27
-	 * @return int|bool         The occurrence's index if found,
28
-	 *                          otherwise false.
29
-	 */
30
-	public function indexOf($needle, $offset = 0)
31
-	{
32
-		return UTF8::strpos
33
-		(
34
-			$this->scalarString,
35
-			(string)$needle,
36
-			(int)$offset,
37
-			$this->encoding
38
-		);
39
-	}
19
+     * Returns the index of the first occurrence of $needle in the string,
20
+     * and false if not found. Accepts an optional offset from which to begin
21
+     * the search.
22
+     *
23
+     * @param  string   $needle Substring to look for.
24
+     *
25
+     * @param  int      $offset Offset from which to search.
26
+     *
27
+     * @return int|bool         The occurrence's index if found,
28
+     *                          otherwise false.
29
+     */
30
+    public function indexOf($needle, $offset = 0)
31
+    {
32
+        return UTF8::strpos
33
+        (
34
+            $this->scalarString,
35
+            (string)$needle,
36
+            (int)$offset,
37
+            $this->encoding
38
+        );
39
+    }
40 40
 
41
-	/**
42
-	 * Returns the index of the last occurrence of $needle in the string,
43
-	 * and false if not found. Accepts an optional offset from which to begin
44
-	 * the search. Offsets may be negative to count from the last character
45
-	 * in the string.
46
-	 *
47
-	 * @param  string   $needle Substring to look for.
48
-	 *
49
-	 * @param  int      $offset Offset from which to search.
50
-	 *
51
-	 * @return int|bool         The last occurrence's index if found,
52
-	 *                          otherwise false.
53
-	 */
54
-	public function indexOfLast($needle, $offset = 0)
55
-	{
56
-		return UTF8::strrpos
57
-		(
58
-			$this->scalarString,
59
-			(string)$needle,
60
-			(int)$offset,
61
-			$this->encoding
62
-		);
63
-	}
41
+    /**
42
+     * Returns the index of the last occurrence of $needle in the string,
43
+     * and false if not found. Accepts an optional offset from which to begin
44
+     * the search. Offsets may be negative to count from the last character
45
+     * in the string.
46
+     *
47
+     * @param  string   $needle Substring to look for.
48
+     *
49
+     * @param  int      $offset Offset from which to search.
50
+     *
51
+     * @return int|bool         The last occurrence's index if found,
52
+     *                          otherwise false.
53
+     */
54
+    public function indexOfLast($needle, $offset = 0)
55
+    {
56
+        return UTF8::strrpos
57
+        (
58
+            $this->scalarString,
59
+            (string)$needle,
60
+            (int)$offset,
61
+            $this->encoding
62
+        );
63
+    }
64 64
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function indexOf($needle, $offset = 0)
31 31
 	{
32
-		return UTF8::strpos
33
-		(
32
+		return UTF8::strpos(
34 33
 			$this->scalarString,
35 34
 			(string)$needle,
36 35
 			(int)$offset,
@@ -53,8 +52,7 @@  discard block
 block discarded – undo
53 52
 	 */
54 53
 	public function indexOfLast($needle, $offset = 0)
55 54
 	{
56
-		return UTF8::strrpos
57
-		(
55
+		return UTF8::strrpos(
58 56
 			$this->scalarString,
59 57
 			(string)$needle,
60 58
 			(int)$offset,
Please login to merge, or discard this patch.
src/Methods/LongestCommon.php 3 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -16,113 +16,113 @@
 block discarded – undo
16 16
 trait LongestCommon
17 17
 {
18 18
     /**
19
-	 * Returns the longest common prefix between the string and $otherStr.
20
-	 *
21
-	 * @param  string $otherStr Second string for comparison
22
-	 *
23
-	 * @return static           String being the longest common prefix
24
-	 */
25
-	public function longestCommonPrefix($otherStr)
26
-	{
27
-		$longestCommonPrefix = '';
28
-
29
-		for ($i = 0; $i < min($this->getLength(), UTF8::strlen($otherStr, $this->encoding)); $i++)
30
-		{
31
-			$char = UTF8::substr($this->scalarString, $i, 1, $this->encoding);
32
-
33
-			if ($char == UTF8::substr($otherStr, $i, 1, $this->encoding))
34
-			{
35
-				$longestCommonPrefix .= $char;
36
-			}
37
-			else
38
-			{
39
-				break;
40
-			}
41
-		}
42
-
43
-		return $this->newSelf($longestCommonPrefix);
44
-	}
45
-
46
-	/**
47
-	 * Returns the longest common suffix between the string and $otherStr.
48
-	 *
49
-	 * @param  string $otherStr Second string for comparison
50
-	 *
51
-	 * @return static           String being the longest common suffix
52
-	 */
53
-	public function longestCommonSuffix($otherStr)
54
-	{
55
-		$longestCommonSuffix = '';
56
-
57
-		for ($i = 1; $i <= min($this->getLength(), UTF8::strlen($otherStr, $this->encoding)); $i++)
58
-		{
59
-			$char = UTF8::substr($this->scalarString, -$i, 1, $this->encoding);
60
-
61
-			if ($char == UTF8::substr($otherStr, -$i, 1, $this->encoding))
62
-			{
63
-				$longestCommonSuffix = $char . $longestCommonSuffix;
64
-			}
65
-			else
66
-			{
67
-				break;
68
-			}
69
-		}
70
-
71
-		return $this->newSelf($longestCommonSuffix);
72
-	}
73
-
74
-	/**
75
-	 * Returns the longest common substring between the string and $otherStr.
76
-	 * In the case of ties, it returns that which occurs first.
77
-	 *
78
-	 * @param  string $otherStr Second string for comparison
79
-	 *
80
-	 * @return static           String being the longest common substring
81
-	 */
82
-	public function longestCommonSubstring($otherStr)
83
-	{
84
-		// Uses dynamic programming to solve
85
-		// http://en.wikipedia.org/wiki/Longest_common_substring_problem
86
-
87
-		$strLength = $this->getLength();
88
-		$otherLength = UTF8::strlen($otherStr, $this->encoding);
89
-
90
-		// Return if either string is empty
91
-		if ($strLength == 0 || $otherLength == 0) return $this->newSelf('');
92
-
93
-		$len = 0; $end = 0;
94
-		$table = array_fill(0, $strLength + 1, array_fill(0, $otherLength + 1, 0));
95
-
96
-		for ($i = 1; $i <= $strLength; $i++)
97
-		{
98
-			for ($j = 1; $j <= $otherLength; $j++)
99
-			{
100
-				$strChar = UTF8::substr($this->scalarString, $i - 1, 1, $this->encoding);
101
-				$otherChar = UTF8::substr($otherStr, $j - 1, 1, $this->encoding);
102
-
103
-				if ($strChar == $otherChar)
104
-				{
105
-					$table[$i][$j] = $table[$i - 1][$j - 1] + 1;
106
-
107
-					if ($table[$i][$j] > $len)
108
-					{
109
-						$len = $table[$i][$j];
110
-						$end = $i;
111
-					}
112
-				}
113
-				else
114
-				{
115
-					$table[$i][$j] = 0;
116
-				}
117
-			}
118
-		}
119
-
120
-		return $this->newSelf(UTF8::substr
121
-		(
122
-			$this->scalarString,
123
-			$end - $len,
124
-			$len,
125
-			$this->encoding
126
-		));
127
-	}
19
+     * Returns the longest common prefix between the string and $otherStr.
20
+     *
21
+     * @param  string $otherStr Second string for comparison
22
+     *
23
+     * @return static           String being the longest common prefix
24
+     */
25
+    public function longestCommonPrefix($otherStr)
26
+    {
27
+        $longestCommonPrefix = '';
28
+
29
+        for ($i = 0; $i < min($this->getLength(), UTF8::strlen($otherStr, $this->encoding)); $i++)
30
+        {
31
+            $char = UTF8::substr($this->scalarString, $i, 1, $this->encoding);
32
+
33
+            if ($char == UTF8::substr($otherStr, $i, 1, $this->encoding))
34
+            {
35
+                $longestCommonPrefix .= $char;
36
+            }
37
+            else
38
+            {
39
+                break;
40
+            }
41
+        }
42
+
43
+        return $this->newSelf($longestCommonPrefix);
44
+    }
45
+
46
+    /**
47
+     * Returns the longest common suffix between the string and $otherStr.
48
+     *
49
+     * @param  string $otherStr Second string for comparison
50
+     *
51
+     * @return static           String being the longest common suffix
52
+     */
53
+    public function longestCommonSuffix($otherStr)
54
+    {
55
+        $longestCommonSuffix = '';
56
+
57
+        for ($i = 1; $i <= min($this->getLength(), UTF8::strlen($otherStr, $this->encoding)); $i++)
58
+        {
59
+            $char = UTF8::substr($this->scalarString, -$i, 1, $this->encoding);
60
+
61
+            if ($char == UTF8::substr($otherStr, -$i, 1, $this->encoding))
62
+            {
63
+                $longestCommonSuffix = $char . $longestCommonSuffix;
64
+            }
65
+            else
66
+            {
67
+                break;
68
+            }
69
+        }
70
+
71
+        return $this->newSelf($longestCommonSuffix);
72
+    }
73
+
74
+    /**
75
+     * Returns the longest common substring between the string and $otherStr.
76
+     * In the case of ties, it returns that which occurs first.
77
+     *
78
+     * @param  string $otherStr Second string for comparison
79
+     *
80
+     * @return static           String being the longest common substring
81
+     */
82
+    public function longestCommonSubstring($otherStr)
83
+    {
84
+        // Uses dynamic programming to solve
85
+        // http://en.wikipedia.org/wiki/Longest_common_substring_problem
86
+
87
+        $strLength = $this->getLength();
88
+        $otherLength = UTF8::strlen($otherStr, $this->encoding);
89
+
90
+        // Return if either string is empty
91
+        if ($strLength == 0 || $otherLength == 0) return $this->newSelf('');
92
+
93
+        $len = 0; $end = 0;
94
+        $table = array_fill(0, $strLength + 1, array_fill(0, $otherLength + 1, 0));
95
+
96
+        for ($i = 1; $i <= $strLength; $i++)
97
+        {
98
+            for ($j = 1; $j <= $otherLength; $j++)
99
+            {
100
+                $strChar = UTF8::substr($this->scalarString, $i - 1, 1, $this->encoding);
101
+                $otherChar = UTF8::substr($otherStr, $j - 1, 1, $this->encoding);
102
+
103
+                if ($strChar == $otherChar)
104
+                {
105
+                    $table[$i][$j] = $table[$i - 1][$j - 1] + 1;
106
+
107
+                    if ($table[$i][$j] > $len)
108
+                    {
109
+                        $len = $table[$i][$j];
110
+                        $end = $i;
111
+                    }
112
+                }
113
+                else
114
+                {
115
+                    $table[$i][$j] = 0;
116
+                }
117
+            }
118
+        }
119
+
120
+        return $this->newSelf(UTF8::substr
121
+        (
122
+            $this->scalarString,
123
+            $end - $len,
124
+            $len,
125
+            $this->encoding
126
+        ));
127
+    }
128 128
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 			if ($char == UTF8::substr($otherStr, -$i, 1, $this->encoding))
62 62
 			{
63
-				$longestCommonSuffix = $char . $longestCommonSuffix;
63
+				$longestCommonSuffix = $char.$longestCommonSuffix;
64 64
 			}
65 65
 			else
66 66
 			{
@@ -117,8 +117,7 @@  discard block
 block discarded – undo
117 117
 			}
118 118
 		}
119 119
 
120
-		return $this->newSelf(UTF8::substr
121
-		(
120
+		return $this->newSelf(UTF8::substr(
122 121
 			$this->scalarString,
123 122
 			$end - $len,
124 123
 			$len,
Please login to merge, or discard this patch.
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@  discard block
 block discarded – undo
33 33
 			if ($char == UTF8::substr($otherStr, $i, 1, $this->encoding))
34 34
 			{
35 35
 				$longestCommonPrefix .= $char;
36
-			}
37
-			else
36
+			} else
38 37
 			{
39 38
 				break;
40 39
 			}
@@ -61,8 +60,7 @@  discard block
 block discarded – undo
61 60
 			if ($char == UTF8::substr($otherStr, -$i, 1, $this->encoding))
62 61
 			{
63 62
 				$longestCommonSuffix = $char . $longestCommonSuffix;
64
-			}
65
-			else
63
+			} else
66 64
 			{
67 65
 				break;
68 66
 			}
@@ -88,7 +86,9 @@  discard block
 block discarded – undo
88 86
 		$otherLength = UTF8::strlen($otherStr, $this->encoding);
89 87
 
90 88
 		// Return if either string is empty
91
-		if ($strLength == 0 || $otherLength == 0) return $this->newSelf('');
89
+		if ($strLength == 0 || $otherLength == 0) {
90
+		    return $this->newSelf('');
91
+		}
92 92
 
93 93
 		$len = 0; $end = 0;
94 94
 		$table = array_fill(0, $strLength + 1, array_fill(0, $otherLength + 1, 0));
@@ -109,8 +109,7 @@  discard block
 block discarded – undo
109 109
 						$len = $table[$i][$j];
110 110
 						$end = $i;
111 111
 					}
112
-				}
113
-				else
112
+				} else
114 113
 				{
115 114
 					$table[$i][$j] = 0;
116 115
 				}
Please login to merge, or discard this patch.
src/Methods/Remove.php 1 patch
Spacing   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,10 +26,8 @@  discard block
 block discarded – undo
26 26
     {
27 27
         if ($this->startsWith($substring))
28 28
         {
29
-            return $this->newSelf
30
-            (
31
-                UTF8::substr
32
-                (
29
+            return $this->newSelf(
30
+                UTF8::substr(
33 31
                     $this->scalarString,
34 32
                     UTF8::strlen($substring, $this->encoding),
35 33
                     null,
@@ -52,10 +50,8 @@  discard block
 block discarded – undo
52 50
     {
53 51
         if ($this->endsWith($substring))
54 52
         {
55
-            return $this->newSelf
56
-            (
57
-                UTF8::substr
58
-                (
53
+            return $this->newSelf(
54
+                UTF8::substr(
59 55
                     $this->scalarString,
60 56
                     0,
61 57
                     $this->getLength() - UTF8::strlen($substring, $this->encoding),
Please login to merge, or discard this patch.
src/Methods/Has.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -16,22 +16,22 @@
 block discarded – undo
16 16
 trait Has
17 17
 {
18 18
     /**
19
-	 * Does the string have at least one lower case character?
20
-	 *
21
-	 * @return bool Whether or not the string contains a lower case character.
22
-	 */
23
-	public function hasLowerCase()
24
-	{
25
-		return $this->regexMatch('.*[[:lower:]]');
26
-	}
19
+     * Does the string have at least one lower case character?
20
+     *
21
+     * @return bool Whether or not the string contains a lower case character.
22
+     */
23
+    public function hasLowerCase()
24
+    {
25
+        return $this->regexMatch('.*[[:lower:]]');
26
+    }
27 27
 
28
-	/**
29
-	 * Does the string have at least one upper case character?
30
-	 *
31
-	 * @return bool Whether or not the string contains an upper case character.
32
-	 */
33
-	public function hasUpperCase()
34
-	{
35
-		return $this->regexMatch('.*[[:upper:]]');
36
-	}
28
+    /**
29
+     * Does the string have at least one upper case character?
30
+     *
31
+     * @return bool Whether or not the string contains an upper case character.
32
+     */
33
+    public function hasUpperCase()
34
+    {
35
+        return $this->regexMatch('.*[[:upper:]]');
36
+    }
37 37
 }
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,6 @@
 block discarded – undo
11 11
 // -----------------------------------------------------------------------------
12 12
 ////////////////////////////////////////////////////////////////////////////////
13 13
 
14
-use voku\helper\UTF8;
15
-
16 14
 trait Trim
17 15
 {
18 16
     /**
Please login to merge, or discard this patch.
src/Methods/Truncate.php 2 patches
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,15 +36,14 @@  discard block
 block discarded – undo
36 36
         $substringLength = UTF8::strlen($substring, $this->encoding);
37 37
         $length -= $substringLength;
38 38
 
39
-        $truncated = UTF8::substr
40
-        (
39
+        $truncated = UTF8::substr(
41 40
             $this->scalarString,
42 41
             0,
43 42
             $length,
44 43
             $this->encoding
45 44
         );
46 45
 
47
-        return $this->newSelf($truncated . $substring);
46
+        return $this->newSelf($truncated.$substring);
48 47
     }
49 48
 
50 49
     /**
@@ -79,6 +78,6 @@  discard block
 block discarded – undo
79 78
             $truncated = UTF8::substr($truncated, 0, $lastPos, $this->encoding);
80 79
         }
81 80
 
82
-        return $this->newSelf($truncated . $substring);
81
+        return $this->newSelf($truncated.$substring);
83 82
     }
84 83
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function truncate($length, $substring = '')
32 32
     {
33
-        if ($length >= $this->getLength()) return $this;
33
+        if ($length >= $this->getLength()) {
34
+            return $this;
35
+        }
34 36
 
35 37
         // Need to further trim the string so we can append the substring
36 38
         $substringLength = UTF8::strlen($substring, $this->encoding);
@@ -63,7 +65,9 @@  discard block
 block discarded – undo
63 65
      */
64 66
     public function safeTruncate($length, $substring = '')
65 67
     {
66
-        if ($length >= $this->getLength()) return $this;
68
+        if ($length >= $this->getLength()) {
69
+            return $this;
70
+        }
67 71
 
68 72
         // Need to further trim the string so we can append the substring
69 73
         $substringLength = UTF8::strlen($substring, $this->encoding);
Please login to merge, or discard this patch.