src/Mail/Mail.php
private function emailsToString($emails) {

		$format = [];

		foreach($emails as $email) {

			if(true === isset($email -> name) && trim($email -> name) !== '') {
				$format[] = sprintf('"%s" <%s>', $email -> name, filter_var($email -> email, FILTER_SANITIZE_EMAIL));
			}
			else {
				$format[] = filter_var($email -> email, FILTER_SANITIZE_EMAIL);
			}
		}

		$emails = implode($format, ',');

		return ('' !== trim($emails)) ? $emails : null;
	}
private function emailsToString($emails) {

		$format = [];

		foreach($emails as $email) {

			if(true === isset($email -> name) && trim($email -> name) !== '') {
				$format[] = sprintf('"%s" <%s>', $email -> name, filter_var($email -> email, FILTER_SANITIZE_EMAIL));
			}
			else {
				$format[] = filter_var($email -> email, FILTER_SANITIZE_EMAIL);
			}
		}

		$emails = implode($format, ',');

		return ('' !== trim($emails)) ? $emails : null;
	}
private function emailsToString ( $ emails ) { $ format = [ ] ; foreach ( $ emails as $ email ) { if ( true === isset ( $ email -> name ) && trim ( $ email -> name ) !== '' ) { $ format [ ] = sprintf ( '"%s" <%s>' , $ email -> name , filter_var ( $ email -> email , FILTER_SANITIZE_EMAIL ) ) ; } else { $ format [ ] = filter_var ( $ email -> email , FILTER_SANITIZE_EMAIL ) ; } } $ emails = implode ( $ format , ',' ) ; return ( '' !== trim ( $ emails ) ) ? $ emails : null ; }
Formats an array with emails to string
@param array $emails
@return null|string
Formats an array with emails to string