From 69b72083be9f53711bf283793a6124c62cdc6b7f Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 24 Nov 2009 22:06:55 -0500 Subject: [PATCH] Adding docblock and removing a call to array_slice() --- cake/libs/view/helpers/text.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cake/libs/view/helpers/text.php b/cake/libs/view/helpers/text.php index 0f4c490e1df..63b02925e10 100644 --- a/cake/libs/view/helpers/text.php +++ b/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); } } ?> \ No newline at end of file