fixed str::words php notice.
This commit is contained in:
parent
1dea9852a9
commit
a994c30ab3
|
@ -148,6 +148,8 @@ public static function limit($value, $limit = 100, $end = '...')
|
||||||
*/
|
*/
|
||||||
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]))
|
||||||
|
|
Loading…
Reference in New Issue