Return an array representing a EmailAddress object for the Twilio SendGrid API

@return null|array
480304
public function jsonSerialize()
    {
        return array_filter(
            [
                'name' => $this->getName(),
                'email' => $this->getEmail()
            ],
            function ($value) {
                return $value !== null;
            }
        ) ?: null;
    }
510689
public function getSender()
    {
        $addresses = $this->transformArrayToAddresses($this->message->getSender());

        if ($address = reset($addresses)) {
            return $address;
        }

        return null;
    }
963322
public function toArray(): array
    {
        return [
            'name' => $this->name,
            'text' => $this->text,
            'style' => $this->style,
            'type' => $this->type,
            'value' => $this->value,
            'confirm' => $this->confirm ? $this->confirm->toArray() : null,
        ];
    }
651602
public function listVerifiedEmailAddresses() {
		$rest = new SimpleEmailServiceRequest($this, 'GET');
		$rest->setParameter('Action', 'ListVerifiedEmailAddresses');

		$rest = $rest->getResponse();
		if($rest->error === false && $rest->code !== 200) {
			$rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
		}
		if($rest->error !== false) {
			$this->__triggerError('listVerifiedEmailAddresses', $rest->error);
			return false;
		}

		$response = array();
		if(!isset($rest->body)) {
			return $response;
		}

		$addresses = array();
		foreach($rest->body->ListVerifiedEmailAddressesResult->VerifiedEmailAddresses->member as $address) {
			$addresses[] = (string)$address;
		}

		$response['Addresses'] = $addresses;
		$response['RequestId'] = (string)$rest->body->ResponseMetadata->RequestId;

		return $response;
	}
1213613
public function getRecipients()
    {
        switch ($this->getSystemMessageType()) {
            case self::LETTER_TYPE_NORMAL:
                return $this->data['recipients'];
                break;

            case self::LETTER_TYPE_HYBRID:
                return $this->data['recipientsPrinted'];
                break;
        }

        return null;
    }
406422
public function getCustomFromAddresses()
    {
        $url = $this->getApiEndpoint() . self::REST_CAMPAIGN_FROM_ADDRESS_LIST;
        $this->setUrl($url)
            ->setVerb('GET');

        $response = $this->execute();

        if (isset($response->message)) {
            $message = 'GET CampaignFromAddressList ' . $response->message
                . ' api user : ' . $this->getApiUsername();
            $this->helper->debug('getCustomFromAddresses', [$message]);
        }

        return $response;
    }
571725
public function getAddresses()
    {
        $addresses = [];
        $groups    = $this->rpc->query("listAddressGroupings");
        foreach($groups as $group) {
            foreach($group as $info) {
                $addresses[] = $info[0];
            }
        }

        return $addresses;
    }
860078
public function toArray()
    {
        return [
            'id' => $this->id,
            'author_name' => $this->authorName,
            'author_email' => $this->authorEmail,
            'committer_name' => $this->committerName,
            'committer_email' => $this->committerEmail,
            'message' => $this->message,
        ];
    }
468870
public function mapInboundPostVarsToEmail_messagesFields() {

        $data = [];

        $data['user_id']            = $this->getUserIdByMappedEmailAddress();

        $data['from_email_address'] = trim($this->request->input('sender'));
        $data['from_name']          = $this->genericWashText($this->request ->input('from'));
        $data['to_email_address']   = $this->setToEmailAddressField();
        $data['to_name']            = $this->setToField();
        $data['subject']            = $this->genericWashText($this->request->input('subject'));
        $data['body']               = $this->setBodyField();
        $data['message_header']     = json_decode($this->request->input('message-headers'));
        $data['recipient']          = $this->request->input('recipient');

        return $data;
    }
766256
public function build()
    {
        $params = [
            'external_user_ids' => $this->externalUserIds,
            'segment_id' => $this->segmentId,
            'campaign_id' => $this->campaignId,
            'override_frequency_capping' => $this->overrideFrequencyCapping,
            'recipient_subscription_state' => $this->recipientSubscriptionState,
            'messages' => $this->messages,
        ];

        return array_filter($params, function ($param) {
            return $param !== null;
        });
    }
741556
public function getUserIdByMappedEmailAddress() {

        // get the mapped recipient (valid because $this->isInboundEmailToEmailAddressMapToUser() is already done)
        $mappedRoutes = config('lasallecmsmailgun.inbound_map_mailgun_routes_with_user_email_address');

        foreach ($mappedRoutes as $route => $user) {

            // if "from" email address is the same as the route specified in the config...
            if ($this->request->input('recipient') == $route) {
                $userEmailAddress = $user;
            }
        }

        return $this->userRepository->findUserIdByEmail($userEmailAddress);
    }
202784
public function jsonSerialize()
    {
        $result = array();
        foreach (get_object_vars($this) as $k => $v) {
            if (isset($v)) {
                // JSON specification set by server requires sublevel of "address" for these
                // attributes of the MailNotification, so they are special cases handled below
                if ($k == "toAddresses") {
                    $result[$k] = array("address" => $this->toAddresses);
                }
                else if ($k == "ccAddresses") {
                    $result[$k] = array("address" => $this->ccAddresses);
                }
                else if ($k == "bccAddresses") {
                    $result[$k] = array("address" => $this->bccAddresses);
                }
                else {
                    $result[$k] = $v;
                }
            }
        }
        return $result;
    }
504287
public function getUserEmails()
    {
        $project = $this->getProject();
        if (!$project) {
            return [];
        }

        $emails = [];
        foreach ($this->api->getProjectAccesses($project) as $projectAccess) {
            $account = $this->api->getAccount($projectAccess);
            $emails[] = $account['email'];
        }

        return $emails;
    }
958465
public function getCustomerData()
    {
        $data = array(
            'disable_send_mail' => $this->getSendMail(),
            'locale'            => $this->getLocale(),
        );

        if (is_null($this->getCard())) {
            return array_filter($data);
        }

        $cardData = array(
            'address1'         => $this->getCard()->getAddress1(),
            'address2'         => $this->getCard()->getAddress2(),
            'city'              => $this->getCard()->getCity(),
            'country'           => $this->getCard()->getCountry(),
            'email'             => $this->getCard()->getEmail(),
            'first_name'        => $this->getCard()->getFirstName(),
            'house_number'      => $this->getVar1(),
            'last_name'         => $this->getCard()->getLastName(),
            'phone'             => $this->getCard()->getPhone(),
            'state'             => $this->getCard()->getState(),
            'zip_code'          => $this->getCard()->getPostcode(),
        );

        return array_filter(
            array_merge($data, $cardData)
        );
    }
167540
public function getClientAddress()
    {
        $address = null;
        if ($this->getHeaderLine('X_FORWARDED_FOR') && $this->trustProxy) {
            $address = $this->getHeaderLine('X_FORWARDED_FOR');
        }

        if (is_null($address) && $this->getServer('REMOTE_ADDR')) {
            $address = $this->getServer('REMOTE_ADDR');
        }

        if ($address) {
            $addresses = explode(',', $address);
            return $addresses[0];
        }

        return '';
    }
586033
protected function genericMessageToArray()
    {
        $message = [];
        $message['recipient'] = $this->recipient;
        $message['notification_type'] = $this->notificationType;
        $message['message']['attachment']['type'] = 'template';
        $message['message']['attachment']['payload']['template_type'] = 'generic';
        $message['message']['attachment']['payload']['elements'] = $this->cards;

        return $message;
    }
486367
public function getList($id = null)
    {
        if ($this->_mails) {
            if ($id != null && isset($this->_mails[$id])) {
                return [filesize($this->_path.'/'.$this->_mails[$id]['file_name'])];
            }

            $result = [];
            foreach ($this->_mails as $mail) {
                $result[] = filesize($this->_path.'/'.$mail['file_name']);
            }

            return $result;
        }

        return null;
    }