Skip to content

Commit 19c5054

Browse files
committed
formatting
1 parent 9f34210 commit 19c5054

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/Illuminate/Support/Stringable.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function explode($delimiter, $limit = PHP_INT_MAX)
195195
}
196196

197197
/**
198-
* Split string by a regular expression.
198+
* Split a string using a regular expression.
199199
*
200200
* @param string $pattern
201201
* @param int $limit
@@ -204,13 +204,9 @@ public function explode($delimiter, $limit = PHP_INT_MAX)
204204
*/
205205
public function split($pattern, $limit = -1, $flags = 0)
206206
{
207-
$keywords = preg_split($pattern, $this->value, $limit, $flags);
207+
$segments = preg_split($pattern, $this->value, $limit, $flags);
208208

209-
if (! $keywords) {
210-
return collect();
211-
}
212-
213-
return collect($keywords);
209+
return ! empty($segments) ? collect($segments) : collect();
214210
}
215211

216212
/**

0 commit comments

Comments
 (0)