Skip to content

Commit

Permalink
[+]: rename "UTF8::words_limit()" -> "UTF8::str_limit_after_word()"
Browse files Browse the repository at this point in the history
  • Loading branch information
voku committed Mar 14, 2016
1 parent 838d84e commit adb9006
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/voku/helper/UTF8.php
Original file line number Diff line number Diff line change
Expand Up @@ -1603,15 +1603,15 @@ public static function words_limit($str, $words = 100, $strAddOn = '...')
}

/**
* Limit the number of characters in a string.
* Limit the number of characters in a string, but also after the next word.
*
* @param string $str
* @param int $length
* @param string $strAddOn
*
* @return string
*/
public static function str_limit($str, $length = 100, $strAddOn = '...')
public static function str_limit_after_word($str, $length = 100, $strAddOn = '...')
{
if (!isset($str[0])) {
return '';
Expand Down
2 changes: 1 addition & 1 deletion tests/UTF8Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ public function testStrLimit()
);

foreach ($testArray as $test) {
self::assertEquals($test[0], UTF8::str_limit($test[1], $test[2], $test[3]), 'tested: ' . $test[1]);
self::assertEquals($test[0], UTF8::str_limit_after_word($test[1], $test[2], $test[3]), 'tested: ' . $test[1]);
}
}

Expand Down

0 comments on commit adb9006

Please sign in to comment.