Permalink
Browse files

Adding docblock and removing a call to array_slice()

  • Loading branch information...
1 parent 53bfc8c commit 69b72083be9f53711bf283793a6124c62cdc6b7f @markstory markstory committed Nov 25, 2009
Showing with 4 additions and 2 deletions.
  1. +4 −2 cake/libs/view/helpers/text.php
@@ -328,11 +328,13 @@ function excerpt($text, $phrase, $radius = 100, $ending = '...') {
* Creates a comma separated list where the last two items are joined with 'and', forming natural English
*
* @param array $list The list to be joined
- * @return string
+ * @param string $and The word used to join the last and second last items together with. Defaults to 'and'
+ * @param string $separator The separator used to join all othe other items together. Defaults to ', '
+ * @return string The glued together string.
* @access public
*/
function toList($list, $and = 'and', $separator = ', ') {
- return implode($separator, array_slice($list, null, -1)) . ' ' . $and . ' ' . array_pop(array_slice($list, -1));
+ return implode($separator, array_slice($list, null, -1)) . ' ' . $and . ' ' . array_pop($list);
}
}
?>

0 comments on commit 69b7208

Please sign in to comment.