Code Duplication    Length = 15-15 lines in 2 locations

src/Mailgun/Messages/MessageBuilder.php 2 locations

@@ 367-381 (lines=15) @@
364
     *
365
     * @return string|int
366
     */
367
    public function addCampaignId($campaignId)
368
    {
369
        if ($this->counters['attributes']['campaign_id'] < Api::CAMPAIGN_ID_LIMIT) {
370
            if (isset($this->message['o:campaign'])) {
371
                array_push($this->message['o:campaign'], (string) $campaignId);
372
            } else {
373
                $this->message['o:campaign'] = [(string) $campaignId];
374
            }
375
            $this->counters['attributes']['campaign_id'] += 1;
376
377
            return $this->message['o:campaign'];
378
        } else {
379
            throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_CAMPAIGNS);
380
        }
381
    }
382
383
    /**
384
     * @param string $tag
@@ 388-402 (lines=15) @@
385
     *
386
     * @throws TooManyParameters
387
     */
388
    public function addTag($tag)
389
    {
390
        if ($this->counters['attributes']['tag'] < Api::TAG_LIMIT) {
391
            if (isset($this->message['o:tag'])) {
392
                array_push($this->message['o:tag'], $tag);
393
            } else {
394
                $this->message['o:tag'] = [$tag];
395
            }
396
            $this->counters['attributes']['tag'] += 1;
397
398
            return $this->message['o:tag'];
399
        } else {
400
            throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_TAGS);
401
        }
402
    }
403
404
    /**
405
     * @param bool $enabled