@@ -26,10 +26,8 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function htmlDecode($flags = ENT_COMPAT) |
| 28 | 28 | { |
| 29 | - return $this->newSelf |
|
| 30 | - ( |
|
| 31 | - UTF8::html_entity_decode |
|
| 32 | - ( |
|
| 29 | + return $this->newSelf( |
|
| 30 | + UTF8::html_entity_decode( |
|
| 33 | 31 | $this->scalarString, |
| 34 | 32 | $flags, |
| 35 | 33 | $this->encoding |
@@ -54,10 +52,8 @@ discard block |
||
| 54 | 52 | { |
| 55 | 53 | if ($flags === null) $flags = ENT_QUOTES | ENT_SUBSTITUTE; |
| 56 | 54 | |
| 57 | - return $this->newSelf |
|
| 58 | - ( |
|
| 59 | - UTF8::htmlentities |
|
| 60 | - ( |
|
| 55 | + return $this->newSelf( |
|
| 56 | + UTF8::htmlentities( |
|
| 61 | 57 | $this->scalarString, |
| 62 | 58 | $flags, |
| 63 | 59 | $this->encoding, |
@@ -97,8 +93,7 @@ discard block |
||
| 97 | 93 | } |
| 98 | 94 | else |
| 99 | 95 | { |
| 100 | - throw new \RuntimeException |
|
| 101 | - ( |
|
| 96 | + throw new \RuntimeException( |
|
| 102 | 97 | "This method requires \voku\helper\AntiXSS. ". |
| 103 | 98 | "Install with: composer require voku/anti-xss" |
| 104 | 99 | ); |
@@ -122,8 +117,7 @@ discard block |
||
| 122 | 117 | */ |
| 123 | 118 | public function htmlStripTags($allowableTags = null) |
| 124 | 119 | { |
| 125 | - return $this->newSelf |
|
| 126 | - ( |
|
| 120 | + return $this->newSelf( |
|
| 127 | 121 | UTF8::strip_tags($this->scalarString, $allowableTags) |
| 128 | 122 | ); |
| 129 | 123 | } |
@@ -52,7 +52,10 @@ |
||
| 52 | 52 | */ |
| 53 | 53 | public function htmlEncode($flags = null, $doubleEncode = true) |
| 54 | 54 | { |
| 55 | - if ($flags === null) $flags = ENT_QUOTES | ENT_SUBSTITUTE; |
|
| 55 | + if ($flags === null) |
|
| 56 | + { |
|
| 57 | + $flags = ENT_QUOTES | ENT_SUBSTITUTE; |
|
| 58 | + } |
|
| 56 | 59 | |
| 57 | 60 | return $this->newSelf |
| 58 | 61 | ( |
@@ -29,8 +29,7 @@ discard block |
||
| 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 |
||
| 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, |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $first = UTF8::substr($this->scalarString, 0, 1, $this->encoding); |
| 26 | 26 | |
| 27 | - $rest = UTF8::substr |
|
| 28 | - ( |
|
| 27 | + $rest = UTF8::substr( |
|
| 29 | 28 | $this->scalarString, |
| 30 | 29 | 1, |
| 31 | 30 | $this->getLength() - 1, |
@@ -44,8 +43,7 @@ discard block |
||
| 44 | 43 | { |
| 45 | 44 | $first = UTF8::substr($this->scalarString, 0, 1, $this->encoding); |
| 46 | 45 | |
| 47 | - $rest = UTF8::substr |
|
| 48 | - ( |
|
| 46 | + $rest = UTF8::substr( |
|
| 49 | 47 | $this->scalarString, |
| 50 | 48 | 1, |
| 51 | 49 | $this->getLength() - 1, |
@@ -62,10 +60,9 @@ discard block |
||
| 62 | 60 | */ |
| 63 | 61 | public function swapCase() |
| 64 | 62 | { |
| 65 | - return $this->newSelf(preg_replace_callback |
|
| 66 | - ( |
|
| 63 | + return $this->newSelf(preg_replace_callback( |
|
| 67 | 64 | '/[\S]/u', |
| 68 | - function ($match) |
|
| 65 | + function($match) |
|
| 69 | 66 | { |
| 70 | 67 | $marchToUpper = UTF8::strtoupper($match[0], $this->encoding); |
| 71 | 68 | |
@@ -44,8 +44,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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, |
@@ -292,7 +292,10 @@ |
||
| 292 | 292 | |
| 293 | 293 | $camelCase = $this->newSelf($camelCase); |
| 294 | 294 | |
| 295 | - if ($upperFirst === true) $camelCase = $camelCase->upperCaseFirst(); |
|
| 295 | + if ($upperFirst === true) |
|
| 296 | + { |
|
| 297 | + $camelCase = $camelCase->upperCaseFirst(); |
|
| 298 | + } |
|
| 296 | 299 | |
| 297 | 300 | return $camelCase; |
| 298 | 301 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 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 |
||
| 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, |
@@ -88,7 +88,10 @@ |
||
| 88 | 88 | $otherLength = UTF8::strlen($otherStr, $this->encoding); |
| 89 | 89 | |
| 90 | 90 | // Return if either string is empty |
| 91 | - if ($strLength == 0 || $otherLength == 0) return $this->newSelf(''); |
|
| 91 | + if ($strLength == 0 || $otherLength == 0) |
|
| 92 | + { |
|
| 93 | + return $this->newSelf(''); |
|
| 94 | + } |
|
| 92 | 95 | |
| 93 | 96 | $len = 0; $end = 0; |
| 94 | 97 | $table = array_fill(0, $strLength + 1, array_fill(0, $otherLength + 1, 0)); |
@@ -96,15 +96,13 @@ discard block |
||
| 96 | 96 | // Make sure we can use the provided string value as a string. |
| 97 | 97 | if (is_array($string)) |
| 98 | 98 | { |
| 99 | - throw new \InvalidArgumentException |
|
| 100 | - ( |
|
| 99 | + throw new \InvalidArgumentException( |
|
| 101 | 100 | 'Passed value cannot be an array' |
| 102 | 101 | ); |
| 103 | 102 | } |
| 104 | 103 | elseif (is_object($string) && !method_exists($string, '__toString')) |
| 105 | 104 | { |
| 106 | - throw new \InvalidArgumentException |
|
| 107 | - ( |
|
| 105 | + throw new \InvalidArgumentException( |
|
| 108 | 106 | 'Passed object must have a __toString method' |
| 109 | 107 | ); |
| 110 | 108 | } |
@@ -126,7 +124,7 @@ discard block |
||
| 126 | 124 | } |
| 127 | 125 | |
| 128 | 126 | // Set the strings length property. |
| 129 | - $this->stringLength = UTF8::strlen($this->scalarString,$this->encoding); |
|
| 127 | + $this->stringLength = UTF8::strlen($this->scalarString, $this->encoding); |
|
| 130 | 128 | } |
| 131 | 129 | |
| 132 | 130 | /** |
@@ -286,8 +284,7 @@ discard block |
||
| 286 | 284 | throw new \OutOfBoundsException('No character exists at the index'); |
| 287 | 285 | } |
| 288 | 286 | |
| 289 | - return $this->newSelf(UTF8::substr |
|
| 290 | - ( |
|
| 287 | + return $this->newSelf(UTF8::substr( |
|
| 291 | 288 | $this->scalarString, |
| 292 | 289 | $offset, |
| 293 | 290 | 1, |
@@ -259,7 +259,10 @@ |
||
| 259 | 259 | { |
| 260 | 260 | $index = (int)$index; |
| 261 | 261 | |
| 262 | - if ($index >= 0) return ($this->getLength() > $index); |
|
| 262 | + if ($index >= 0) |
|
| 263 | + { |
|
| 264 | + return ($this->getLength() > $index); |
|
| 265 | + } |
|
| 263 | 266 | |
| 264 | 267 | return ($this->getLength() >= abs($index)); |
| 265 | 268 | } |
@@ -88,7 +88,10 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function isJson() |
| 90 | 90 | { |
| 91 | - if ($this->getLength() === 0) return false; |
|
| 91 | + if ($this->getLength() === 0) |
|
| 92 | + { |
|
| 93 | + return false; |
|
| 94 | + } |
|
| 92 | 95 | |
| 93 | 96 | json_decode($this->scalarString); |
| 94 | 97 | |
@@ -102,7 +105,10 @@ discard block |
||
| 102 | 105 | */ |
| 103 | 106 | public function isSerialized() |
| 104 | 107 | { |
| 105 | - if ($this->getLength() === 0) return false; |
|
| 108 | + if ($this->getLength() === 0) |
|
| 109 | + { |
|
| 110 | + return false; |
|
| 111 | + } |
|
| 106 | 112 | |
| 107 | 113 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 108 | 114 | return |
@@ -120,7 +126,10 @@ discard block |
||
| 120 | 126 | public function isBase64() |
| 121 | 127 | { |
| 122 | 128 | // An empty string is by definition not encoded. |
| 123 | - if ($this->getLength() === 0) return false; |
|
| 129 | + if ($this->getLength() === 0) |
|
| 130 | + { |
|
| 131 | + return false; |
|
| 132 | + } |
|
| 124 | 133 | |
| 125 | 134 | // Grab the current string value. |
| 126 | 135 | $possiblyEncoded = $this->scalarString; |
@@ -129,7 +138,10 @@ discard block |
||
| 129 | 138 | $decoded = base64_decode($possiblyEncoded, true); |
| 130 | 139 | |
| 131 | 140 | // If we get false it can't be base64 |
| 132 | - if ($decoded === false) return false; |
|
| 141 | + if ($decoded === false) |
|
| 142 | + { |
|
| 143 | + return false; |
|
| 144 | + } |
|
| 133 | 145 | |
| 134 | 146 | // Lets double check |
| 135 | 147 | return (base64_encode($decoded) === $this->scalarString); |
@@ -53,7 +53,10 @@ discard block |
||
| 53 | 53 | public function regexMatch($pattern, $options = '') |
| 54 | 54 | { |
| 55 | 55 | // Ensure the options contain the "u" modifier. |
| 56 | - if (!$this->newSelf($options)->contains('u')) $options .= 'u'; |
|
| 56 | + if (!$this->newSelf($options)->contains('u')) |
|
| 57 | + { |
|
| 58 | + $options .= 'u'; |
|
| 59 | + } |
|
| 57 | 60 | |
| 58 | 61 | // Build the expression |
| 59 | 62 | $expression = |
@@ -67,7 +70,10 @@ discard block |
||
| 67 | 70 | $result = preg_match($expression, $this->scalarString); |
| 68 | 71 | |
| 69 | 72 | // If no errors return true or false based on number of matches found. |
| 70 | - if ($result !== false) return $result === 1; |
|
| 73 | + if ($result !== false) |
|
| 74 | + { |
|
| 75 | + return $result === 1; |
|
| 76 | + } |
|
| 71 | 77 | |
| 72 | 78 | // Otherwise throw with last known PCRE Error. |
| 73 | 79 | throw new PcreException(); |
@@ -94,7 +100,10 @@ discard block |
||
| 94 | 100 | $matches = []; |
| 95 | 101 | |
| 96 | 102 | // Ensure the options contain the "u" modifier. |
| 97 | - if (!$this->newSelf($options)->contains('u')) $options .= 'u'; |
|
| 103 | + if (!$this->newSelf($options)->contains('u')) |
|
| 104 | + { |
|
| 105 | + $options .= 'u'; |
|
| 106 | + } |
|
| 98 | 107 | |
| 99 | 108 | // Build the expression |
| 100 | 109 | $expression = |
@@ -108,7 +117,10 @@ discard block |
||
| 108 | 117 | $result = preg_match($expression, $this->scalarString, $matches); |
| 109 | 118 | |
| 110 | 119 | // If no errors return the $matches array |
| 111 | - if ($result !== false) return $this->newSelfs($matches); |
|
| 120 | + if ($result !== false) |
|
| 121 | + { |
|
| 122 | + return $this->newSelfs($matches); |
|
| 123 | + } |
|
| 112 | 124 | |
| 113 | 125 | // Otherwise throw with last known PCRE Error. |
| 114 | 126 | throw new PcreException(); |
@@ -131,10 +143,16 @@ discard block |
||
| 131 | 143 | { |
| 132 | 144 | // The original regexReplace method in danielstjules/Stringy used |
| 133 | 145 | // mb_ereg_replace() which supports an "r" flag, PCRE does not. |
| 134 | - if ($options === 'msr') $options = 'ms'; |
|
| 146 | + if ($options === 'msr') |
|
| 147 | + { |
|
| 148 | + $options = 'ms'; |
|
| 149 | + } |
|
| 135 | 150 | |
| 136 | 151 | // Ensure the options contain the "u" modifier. |
| 137 | - if (!$this->newSelf($options)->contains('u')) $options .= 'u'; |
|
| 152 | + if (!$this->newSelf($options)->contains('u')) |
|
| 153 | + { |
|
| 154 | + $options .= 'u'; |
|
| 155 | + } |
|
| 138 | 156 | |
| 139 | 157 | // Build the expression |
| 140 | 158 | $expression = |
@@ -148,7 +166,10 @@ discard block |
||
| 148 | 166 | $replaced = preg_replace($expression, $replacement, $this->scalarString); |
| 149 | 167 | |
| 150 | 168 | // If no errors return the replacement |
| 151 | - if ($replaced !== null) return $this->newSelf($replaced); |
|
| 169 | + if ($replaced !== null) |
|
| 170 | + { |
|
| 171 | + return $this->newSelf($replaced); |
|
| 172 | + } |
|
| 152 | 173 | |
| 153 | 174 | // Otherwise throw with last known PCRE Error. |
| 154 | 175 | throw new PcreException(); |
@@ -170,11 +191,17 @@ discard block |
||
| 170 | 191 | public function split($pattern, $limit = null, $quote = true) |
| 171 | 192 | { |
| 172 | 193 | // Not sure why you would do this but your wish is our command :) |
| 173 | - if ($limit === 0) return []; |
|
| 194 | + if ($limit === 0) |
|
| 195 | + { |
|
| 196 | + return []; |
|
| 197 | + } |
|
| 174 | 198 | |
| 175 | 199 | // UTF8::split errors when supplied an empty pattern in < PHP 5.4.13 |
| 176 | 200 | // and current versions of HHVM (3.8 and below) |
| 177 | - if ($pattern === '') return [$this->newSelf($this->scalarString)]; |
|
| 201 | + if ($pattern === '') |
|
| 202 | + { |
|
| 203 | + return [$this->newSelf($this->scalarString)]; |
|
| 204 | + } |
|
| 178 | 205 | |
| 179 | 206 | // UTF8::split returns the remaining unsplit string |
| 180 | 207 | // in the last index when supplying a limit. |
@@ -208,7 +235,10 @@ discard block |
||
| 208 | 235 | $array = preg_split($expression, $this->scalarString, $limit); |
| 209 | 236 | |
| 210 | 237 | // Remove any remaining unsplit string. |
| 211 | - if ($limit > 0 && count($array) === $limit) array_pop($array); |
|
| 238 | + if ($limit > 0 && count($array) === $limit) |
|
| 239 | + { |
|
| 240 | + array_pop($array); |
|
| 241 | + } |
|
| 212 | 242 | |
| 213 | 243 | return $this->newSelfs($array); |
| 214 | 244 | } |
@@ -53,11 +53,17 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function containsAll($needles, $caseSensitive = true) |
| 55 | 55 | { |
| 56 | - if (empty($needles)) return false; |
|
| 56 | + if (empty($needles)) |
|
| 57 | + { |
|
| 58 | + return false; |
|
| 59 | + } |
|
| 57 | 60 | |
| 58 | 61 | foreach ($needles as $needle) |
| 59 | 62 | { |
| 60 | - if (!$this->contains($needle, $caseSensitive)) return false; |
|
| 63 | + if (!$this->contains($needle, $caseSensitive)) |
|
| 64 | + { |
|
| 65 | + return false; |
|
| 66 | + } |
|
| 61 | 67 | } |
| 62 | 68 | |
| 63 | 69 | return true; |
@@ -77,11 +83,17 @@ discard block |
||
| 77 | 83 | */ |
| 78 | 84 | public function containsAny($needles, $caseSensitive = true) |
| 79 | 85 | { |
| 80 | - if (empty($needles)) return false; |
|
| 86 | + if (empty($needles)) |
|
| 87 | + { |
|
| 88 | + return false; |
|
| 89 | + } |
|
| 81 | 90 | |
| 82 | 91 | foreach ($needles as $needle) |
| 83 | 92 | { |
| 84 | - if ($this->contains($needle, $caseSensitive)) return true; |
|
| 93 | + if ($this->contains($needle, $caseSensitive)) |
|
| 94 | + { |
|
| 95 | + return true; |
|
| 96 | + } |
|
| 85 | 97 | } |
| 86 | 98 | |
| 87 | 99 | return false; |