| @@ 261-275 (lines=15) @@ | ||
| 258 | */ |
|
| 259 | public function pushData($key, $value) |
|
| 260 | { |
|
| 261 | if (isset($this->jsdata[ $key ]) |
|
| 262 | && ! is_array($this->jsdata[ $key ]) |
|
| 263 | ) { |
|
| 264 | throw new InvalidArgumentException( |
|
| 265 | sprintf( |
|
| 266 | __( |
|
| 267 | 'The value for %1$s is already set and it is not an array. The %2$s method can only be used to |
|
| 268 | push values to this data element when it is an array.', |
|
| 269 | 'event_espresso' |
|
| 270 | ), |
|
| 271 | $key, |
|
| 272 | __METHOD__ |
|
| 273 | ) |
|
| 274 | ); |
|
| 275 | } |
|
| 276 | $this->jsdata[ $key ][] = $value; |
|
| 277 | } |
|
| 278 | ||
| @@ 348-361 (lines=14) @@ | ||
| 345 | protected function verifyDataNotExisting($key) |
|
| 346 | { |
|
| 347 | if (isset($this->jsdata[ $key ])) { |
|
| 348 | if (is_array($this->jsdata[ $key ])) { |
|
| 349 | throw new InvalidArgumentException( |
|
| 350 | sprintf( |
|
| 351 | __( |
|
| 352 | 'The value for %1$s already exists in the Registry::eejs object. |
|
| 353 | Overrides are not allowed. Since the value of this data is an array, you may want to use the |
|
| 354 | %2$s method to push your value to the array.', |
|
| 355 | 'event_espresso' |
|
| 356 | ), |
|
| 357 | $key, |
|
| 358 | 'pushData()' |
|
| 359 | ) |
|
| 360 | ); |
|
| 361 | } |
|
| 362 | throw new InvalidArgumentException( |
|
| 363 | sprintf( |
|
| 364 | __( |
|