protected function buildRecipientsField($identities)
    {
        if (null === $identities) {
            return [];
        }

        if (is_string($identities)) {
            return [
                [
                    'Email' => $identities,
                ],
            ];
        }

        $identities = (array) $identities;

        $recipients = [];
        foreach ($identities as $identity) {
            if (is_string($identity)) {
                $recipients[] = [
                    'Email' => $identity,
                ];

                continue;
            }

            $recipient = [
                'Email' => $identity->getEmail(),
            ];

            if (null !== $name = $identity->getName()) {
                $recipient['Name'] = $name;
            }

            $recipients[] = $recipient;
        }

        return $recipients;
    }
protected function buildRecipientsField($identities)
    {
        if (null === $identities) {
            return [];
        }

        if (is_string($identities)) {
            return [
                [
                    'Email' => $identities,
                ],
            ];
        }

        $identities = (array) $identities;

        $recipients = [];
        foreach ($identities as $identity) {
            if (is_string($identity)) {
                $recipients[] = [
                    'Email' => $identity,
                ];

                continue;
            }

            $recipient = [
                'Email' => $identity->getEmail(),
            ];

            if (null !== $name = $identity->getName()) {
                $recipient['Name'] = $name;
            }

            $recipients[] = $recipient;
        }

        return $recipients;
    }
protected function buildRecipientsField ( $ identities ) { if ( null === $ identities ) { return [ ] ; } if ( is_string ( $ identities ) ) { return [ [ 'Email' => $ identities , ] , ] ; } $ identities = ( array ) $ identities ; $ recipients = [ ] ; foreach ( $ identities as $ identity ) { if ( is_string ( $ identity ) ) { $ recipients [ ] = [ 'Email' => $ identity , ] ; continue ; } $ recipient = [ 'Email' => $ identity -> getEmail ( ) , ] ; if ( null !== $ name = $ identity -> getName ( ) ) { $ recipient [ 'Name' ] = $ name ; } $ recipients [ ] = $ recipient ; } return $ recipients ; }
@param IdentityInterface[]|string $identities

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