Tribe__Admin__Notice__Plugin_Download::implode_with_grammar( array $items )
Implodes a list of items with proper grammar.
Contents
If only 1 item, no grammar. If 2 items, just conjunction. If 3+ items, commas with conjunction.
Parameters
- $items
-
(array) (Required) List of items to implode
Return
(string) String of items
Source
File: src/Tribe/Admin/Notice/Plugin_Download.php
public function implode_with_grammar( $items ) {
$separator = _x( ', ', 'separator used in a list of items', 'tribe-common' );
$conjunction = _x( ' and ', 'the final separator in a list of two or more items', 'tribe-common' );
$output = $last_item = array_pop( $items );
if ( $items ) {
$output = implode( $separator, $items ) . $conjunction . $last_item;
}
return $output;
}