public static function buildIdentityString($identities)
    {
        if (null === $identities) {
            return '';
        }

        if (is_string($identities)) {
            return $identities;
        }

        if ($identities instanceof IdentityInterface) {
            $identities = [$identities];
        }

        $stringIdentities = [];

        foreach ($identities as $identity) {
            if (null === $identity->getName()) {
                $stringIdentities[] = $identity->getEmail();
                continue;
            }

            $stringIdentities[] = sprintf('%s <%s>', $identity->getName(), $identity->getEmail());
        }

        return implode(',', $stringIdentities);
    }
public static function buildIdentityString($identities)
    {
        if (null === $identities) {
            return '';
        }

        if (is_string($identities)) {
            return $identities;
        }

        if ($identities instanceof IdentityInterface) {
            $identities = [$identities];
        }

        $stringIdentities = [];

        foreach ($identities as $identity) {
            if (null === $identity->getName()) {
                $stringIdentities[] = $identity->getEmail();
                continue;
            }

            $stringIdentities[] = sprintf('%s <%s>', $identity->getName(), $identity->getEmail());
        }

        return implode(',', $stringIdentities);
    }
public static function buildIdentityString ( $ identities ) { if ( null === $ identities ) { return '' ; } if ( is_string ( $ identities ) ) { return $ identities ; } if ( $ identities instanceof IdentityInterface ) { $ identities = [ $ identities ] ; } $ stringIdentities = [ ] ; foreach ( $ identities as $ identity ) { if ( null === $ identity -> getName ( ) ) { $ stringIdentities [ ] = $ identity -> getEmail ( ) ; continue ; } $ stringIdentities [ ] = sprintf ( '%s <%s>' , $ identity -> getName ( ) , $ identity -> getEmail ( ) ) ; } return implode ( ',' , $ stringIdentities ) ; }
@param IdentityInterface[]|IdentityInterface|string $identities

@return string
@param IdentityInterface [] |IdentityInterface|string $identities