| @@ 156-170 (lines=15) @@ | ||
| 153 | */ |
|
| 154 | public function pushData($key, $value) |
|
| 155 | { |
|
| 156 | if (isset($this->jsdata[$key]) |
|
| 157 | && ! is_array($this->jsdata[$key]) |
|
| 158 | ) { |
|
| 159 | throw new invalidArgumentException( |
|
| 160 | sprintf( |
|
| 161 | __( |
|
| 162 | 'The value for %1$s is already set and it is not an array. The %2$s method can only be used to |
|
| 163 | push values to this data element when it is an array.', |
|
| 164 | 'event_espresso' |
|
| 165 | ), |
|
| 166 | $key, |
|
| 167 | __METHOD__ |
|
| 168 | ) |
|
| 169 | ); |
|
| 170 | } |
|
| 171 | $this->jsdata[$key][] = $value; |
|
| 172 | } |
|
| 173 | ||
| @@ 247-260 (lines=14) @@ | ||
| 244 | protected function verifyDataNotExisting($key) |
|
| 245 | { |
|
| 246 | if (isset($this->jsdata[$key])) { |
|
| 247 | if (is_array($this->jsdata[$key])) { |
|
| 248 | throw new InvalidArgumentException( |
|
| 249 | sprintf( |
|
| 250 | __( |
|
| 251 | 'The value for %1$s already exists in the Registry::eejs object. |
|
| 252 | Overrides are not allowed. Since the value of this data is an array, you may want to use the |
|
| 253 | %2$s method to push your value to the array.', |
|
| 254 | 'event_espresso' |
|
| 255 | ), |
|
| 256 | $key, |
|
| 257 | 'pushData()' |
|
| 258 | ) |
|
| 259 | ); |
|
| 260 | } |
|
| 261 | throw new InvalidArgumentException( |
|
| 262 | sprintf( |
|
| 263 | __( |
|