Created
October 12, 2023 20:22
-
-
Save aklump/84ab03b9f16c4bda4bfb1ab2d91067bb to your computer and use it in GitHub Desktop.
csv using "and"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HumanList { | |
use \Drupal\Core\StringTranslation\StringTranslationTrait; | |
public function __invoke(array $items): string { | |
$last = array_pop($items); | |
return $this->t(':items and :item', [ | |
':items' => implode(', ', $items), | |
':item' => $last, | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment