SparkPost\Transmission::formatShorthandRecipients PHP Method

formatShorthandRecipients() private method

Formats all recipients into the long form of [ "name" => "John", "email" => "[email protected]" ].
private formatShorthandRecipients ( array $payload ) : array
$payload array - the request body
return array - the modified request body
    private function formatShorthandRecipients($payload)
    {
        if (isset($payload['content']['from'])) {
            $payload['content']['from'] = $this->toAddressObject($payload['content']['from']);
        }
        for ($i = 0; $i < count($payload['recipients']); ++$i) {
            $payload['recipients'][$i]['address'] = $this->toAddressObject($payload['recipients'][$i]['address']);
        }
        return $payload;
    }