public function addTag($tag)
{
if ($this->counters['attributes']['tag'] < Api::TAG_LIMIT) {
if (isset($this->message['o:tag'])) {
array_push($this->message['o:tag'], $tag);
} else {
$this->message['o:tag'] = [$tag];
}
$this->counters['attributes']['tag'] += 1;
return $this->message['o:tag'];
} else {
throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_TAGS);
}
}
/** * Add Mailgun tags to the message. * Tag limit is 3. * * @param string|array $tags * * @return \Bogardo\Mailgun\Mail\Message */ public function tag($tags) { $tags = array_slice((array) $tags, 0, 3); foreach ($tags as $tag) { $this->messageBuilder->addTag($tag); } return $this; }