code: 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);
      }
docs: @param IdentityInterface[]|IdentityInterface|string $identities
  
  @return string