Mailgun\Messages\BatchMessage::addRecipient PHP Метод

addRecipient() защищенный Метод

protected addRecipient ( string $headerName, string $address, array $variables )
$headerName string
$address string
$variables array
    protected function addRecipient($headerName, $address, $variables)
    {
        if (array_key_exists($headerName, $this->counters['recipients'])) {
            if ($this->counters['recipients'][$headerName] == Api::RECIPIENT_COUNT_LIMIT) {
                if ($this->autoSend == false) {
                    throw new TooManyParameters(ExceptionMessages::TOO_MANY_RECIPIENTS);
                }
                $this->sendMessage();
            }
        }
        $compiledAddress = $this->parseAddress($address, $variables);
        if (isset($this->message[$headerName])) {
            array_push($this->message[$headerName], $compiledAddress);
        } elseif ($headerName == 'h:reply-to') {
            $this->message[$headerName] = $compiledAddress;
        } else {
            $this->message[$headerName] = [$compiledAddress];
        }
        if (array_key_exists($headerName, $this->counters['recipients'])) {
            $this->counters['recipients'][$headerName] += 1;
            if (is_array($variables) && !array_key_exists('id', $variables)) {
                $variables['id'] = $this->counters['recipients'][$headerName];
            }
        }
        $this->batchRecipientAttributes["{$address}"] = $variables;
    }