| @@ 342-354 (lines=13) @@ | ||
| 339 | * |
|
| 340 | * @throws LimitExceeded |
|
| 341 | */ |
|
| 342 | public function addTag($tag) |
|
| 343 | { |
|
| 344 | if ($this->counters['attributes']['tag'] >= self::TAG_LIMIT) { |
|
| 345 | throw LimitExceeded::create('tags', self::TAG_LIMIT); |
|
| 346 | } |
|
| 347 | ||
| 348 | if (isset($this->message['o:tag'])) { |
|
| 349 | array_push($this->message['o:tag'], $tag); |
|
| 350 | } else { |
|
| 351 | $this->message['o:tag'] = [$tag]; |
|
| 352 | } |
|
| 353 | $this->counters['attributes']['tag'] += 1; |
|
| 354 | } |
|
| 355 | ||
| 356 | /** |
|
| 357 | * @param bool $enabled |
|
| @@ 368-382 (lines=15) @@ | ||
| 365 | * |
|
| 366 | * @return string|int |
|
| 367 | */ |
|
| 368 | public function addCampaignId($campaignId) |
|
| 369 | { |
|
| 370 | if ($this->counters['attributes']['campaign_id'] < Api::CAMPAIGN_ID_LIMIT) { |
|
| 371 | if (isset($this->message['o:campaign'])) { |
|
| 372 | array_push($this->message['o:campaign'], (string) $campaignId); |
|
| 373 | } else { |
|
| 374 | $this->message['o:campaign'] = [(string) $campaignId]; |
|
| 375 | } |
|
| 376 | $this->counters['attributes']['campaign_id'] += 1; |
|
| 377 | ||
| 378 | return $this->message['o:campaign']; |
|
| 379 | } else { |
|
| 380 | throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_CAMPAIGNS); |
|
| 381 | } |
|
| 382 | } |
|
| 383 | ||
| 384 | /** |
|
| 385 | * @param string $tag |
|
| @@ 389-403 (lines=15) @@ | ||
| 386 | * |
|
| 387 | * @throws TooManyParameters |
|
| 388 | */ |
|
| 389 | public function addTag($tag) |
|
| 390 | { |
|
| 391 | if ($this->counters['attributes']['tag'] < Api::TAG_LIMIT) { |
|
| 392 | if (isset($this->message['o:tag'])) { |
|
| 393 | array_push($this->message['o:tag'], $tag); |
|
| 394 | } else { |
|
| 395 | $this->message['o:tag'] = [$tag]; |
|
| 396 | } |
|
| 397 | $this->counters['attributes']['tag'] += 1; |
|
| 398 | ||
| 399 | return $this->message['o:tag']; |
|
| 400 | } else { |
|
| 401 | throw new TooManyParameters(ExceptionMessages::TOO_MANY_PARAMETERS_TAGS); |
|
| 402 | } |
|
| 403 | } |
|
| 404 | ||
| 405 | /** |
|
| 406 | * @param bool $enabled |
|