| @@ 496-507 (lines=12) @@ | ||
| 493 | * |
|
| 494 | * @return self |
|
| 495 | */ |
|
| 496 | public function addData($key, $value) |
|
| 497 | { |
|
| 498 | if (!is_string($key) && !is_int($key)) { |
|
| 499 | throw new \InvalidArgumentException('Data keys must be of type "string" or "integer".'); |
|
| 500 | } |
|
| 501 | ||
| 502 | $data = $this->getData(); |
|
| 503 | ||
| 504 | $data[$key] = $value; |
|
| 505 | ||
| 506 | return $this->setData($data); |
|
| 507 | } |
|
| 508 | ||
| 509 | /** |
|
| 510 | * Get the value of the payload "alert" key. |
|
| @@ 783-794 (lines=12) @@ | ||
| 780 | * |
|
| 781 | * @return self |
|
| 782 | */ |
|
| 783 | public function addData($key, $value) |
|
| 784 | { |
|
| 785 | if (!is_string($key)) { |
|
| 786 | throw new \InvalidArgumentException('Data keys must be of type string in order to convert data in a valid JSON Object.'); |
|
| 787 | } |
|
| 788 | ||
| 789 | $data = $this->getData(); |
|
| 790 | ||
| 791 | $data[$key] = $value; |
|
| 792 | ||
| 793 | return $this->setData($data); |
|
| 794 | } |
|
| 795 | } |
|
| 796 | ||