| 309 | } |
| 310 | |
| 311 | engine_value *value_array_index_get(engine_value *arr, unsigned long idx) { |
| 312 | HashTable *h = NULL; |
| 313 | engine_value *val = value_new(); |
| 314 | |
| 315 | switch (arr->kind) { |
| 316 | case KIND_ARRAY: |
| 317 | case KIND_MAP: |
| 318 | h = Z_ARRVAL_P(arr->internal); |
| 319 | break; |
| 320 | case KIND_OBJECT: |
| 321 | h = Z_OBJPROP_P(arr->internal); |
| 322 | break; |
| 323 | default: |
| 324 | // Attempting to return the first index of a non-array value will return |
| 325 | // the value itself, allowing for implicit conversions of scalar values |
| 326 | // to arrays. |
| 327 | if (idx == 0) { |
| 328 | value_set_zval(val, arr->internal); |
| 329 | return val; |
| 330 | } |
| 331 | |
| 332 | return val; |
| 333 | } |
| 334 | |
| 335 | VALUE_ARRAY_INDEX_GET(h, idx, val); |
| 336 | } |
| 337 | |
| 338 | engine_value *value_array_key_get(engine_value *arr, char *key) { |
| 339 | HashTable *h = NULL; |
nothing calls this directly
no test coverage detected