Skip to content

Commit

Permalink
Adding docblock and removing a call to array_slice()
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 25, 2009
1 parent 53bfc8c commit 69b7208
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cake/libs/view/helpers/text.php
Expand Up @@ -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.