Code Duplication    Length = 15-15 lines in 2 locations

src/Mailgun/Messages/MessageBuilder.php 2 locations

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