Commit a994c30a authored by Taylor Otwell's avatar Taylor Otwell

fixed str::words php notice.

parent 1dea9852
...@@ -148,6 +148,8 @@ class Str { ...@@ -148,6 +148,8 @@ class Str {
*/ */
public static function words($value, $words = 100, $end = '...') public static function words($value, $words = 100, $end = '...')
{ {
if (trim((string) $value) == '') return '';
preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/', $value, $matches); preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/', $value, $matches);
if (static::length($value) == static::length($matches[0])) if (static::length($value) == static::length($matches[0]))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment