| @@ 254-268 (lines=15) @@ | ||
| 251 | */ |
|
| 252 | public function pushData($key, $value) |
|
| 253 | { |
|
| 254 | if (isset($this->jsdata[$key]) |
|
| 255 | && ! is_array($this->jsdata[$key]) |
|
| 256 | ) { |
|
| 257 | throw new invalidArgumentException( |
|
| 258 | sprintf( |
|
| 259 | __( |
|
| 260 | 'The value for %1$s is already set and it is not an array. The %2$s method can only be used to |
|
| 261 | push values to this data element when it is an array.', |
|
| 262 | 'event_espresso' |
|
| 263 | ), |
|
| 264 | $key, |
|
| 265 | __METHOD__ |
|
| 266 | ) |
|
| 267 | ); |
|
| 268 | } |
|
| 269 | $this->jsdata[$key][] = $value; |
|
| 270 | } |
|
| 271 | ||
| @@ 468-481 (lines=14) @@ | ||
| 465 | protected function verifyDataNotExisting($key) |
|
| 466 | { |
|
| 467 | if (isset($this->jsdata[$key])) { |
|
| 468 | if (is_array($this->jsdata[$key])) { |
|
| 469 | throw new InvalidArgumentException( |
|
| 470 | sprintf( |
|
| 471 | __( |
|
| 472 | 'The value for %1$s already exists in the Registry::eejs object. |
|
| 473 | Overrides are not allowed. Since the value of this data is an array, you may want to use the |
|
| 474 | %2$s method to push your value to the array.', |
|
| 475 | 'event_espresso' |
|
| 476 | ), |
|
| 477 | $key, |
|
| 478 | 'pushData()' |
|
| 479 | ) |
|
| 480 | ); |
|
| 481 | } |
|
| 482 | throw new InvalidArgumentException( |
|
| 483 | sprintf( |
|
| 484 | __( |
|