Adjusted phpdoc, tests and changelog for StringHelper::truncate and StringHelper::truncateWords

This commit is contained in:
Alexander Makarov
2014-04-29 18:23:48 +04:00
parent 8d18d722b2
commit a620342315
3 changed files with 23 additions and 15 deletions

View File

@@ -25,7 +25,7 @@ Yii Framework 2 Change Log
- Enh #2264: `CookieCollection::has()` will return false for expired or removed cookies (qiangxue)
- Enh #2837: Error page now shows arguments in stack trace method calls (samdark)
- Enh #2906: Added support for using conditional comments for js and css files registered through asset bundles and Html helper (exromany, qiangxue)
- Enh #2942: Added truncate and truncateWord methods (Alex-Code)
- Enh #2942: Added truncate and truncateWord methods (Alex-Code, samdark)
- Enh #3008: Added `Html::errorSummary()` (qiangxue)
- Enh #3088: The debug and gii modules will manage their own URL rules now (hiltonjanfield, qiangxue)
- Enh #3103: debugger panel is now not displayed when printing a page (githubjeka)

View File

@@ -89,11 +89,12 @@ class BaseStringHelper
}
/**
* Truncates a string to the specified length.
* Truncates a string to the number of characters specified.
*
* @param string $string The string to truncate.
* @param integer $length The new length of the string.
* @param string $suffix A value to affix to the end.
* @param string $encoding The charset to use, defaults to application current.
* @param integer $length How many characters from original string to include into truncated string.
* @param string $suffix String to append to the end of truncated string.
* @param string $encoding The charset to use, defaults to charset currently used by application.
* @return string the truncated string.
*/
public static function truncate($string, $length, $suffix = '...', $encoding = null)
@@ -106,10 +107,11 @@ class BaseStringHelper
}
/**
* Split a string into words preserving whitespace and return the specified amount of words.
* Truncates a string to the number of words specified.
*
* @param string $string The string to truncate.
* @param integer $count How many words to truncate to.
* @param string $suffix A value to affix to the end.
* @param integer $count How many words from original string to include into truncated string.
* @param string $suffix String to append to the end of truncated string.
* @return string the truncated string.
*/
public static function truncateWords($string, $count, $suffix = '...')