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