| @@ 169-183 (lines=15) @@ | ||
| 166 | */ |
|
| 167 | public function pushData($key, $value) |
|
| 168 | { |
|
| 169 | if (isset($this->jsdata[$key]) |
|
| 170 | && ! is_array($this->jsdata[$key]) |
|
| 171 | ) { |
|
| 172 | throw new invalidArgumentException( |
|
| 173 | sprintf( |
|
| 174 | __( |
|
| 175 | 'The value for %1$s is already set and it is not an array. The %2$s method can only be used to |
|
| 176 | push values to this data element when it is an array.', |
|
| 177 | 'event_espresso' |
|
| 178 | ), |
|
| 179 | $key, |
|
| 180 | __METHOD__ |
|
| 181 | ) |
|
| 182 | ); |
|
| 183 | } |
|
| 184 | $this->jsdata[$key][] = $value; |
|
| 185 | } |
|
| 186 | ||
| @@ 260-273 (lines=14) @@ | ||
| 257 | protected function verifyDataNotExisting($key) |
|
| 258 | { |
|
| 259 | if (isset($this->jsdata[$key])) { |
|
| 260 | if (is_array($this->jsdata[$key])) { |
|
| 261 | throw new InvalidArgumentException( |
|
| 262 | sprintf( |
|
| 263 | __( |
|
| 264 | 'The value for %1$s already exists in the Registry::eejs object. |
|
| 265 | Overrides are not allowed. Since the value of this data is an array, you may want to use the |
|
| 266 | %2$s method to push your value to the array.', |
|
| 267 | 'event_espresso' |
|
| 268 | ), |
|
| 269 | $key, |
|
| 270 | 'pushData()' |
|
| 271 | ) |
|
| 272 | ); |
|
| 273 | } |
|
| 274 | throw new InvalidArgumentException( |
|
| 275 | sprintf( |
|
| 276 | __( |
|