Check if field exists for method receiver.
| 38 | |
| 39 | // Check if field exists for method receiver. |
| 40 | static int RECEIVER_EXISTS(zval *object, zval *member, int check) { |
| 41 | engine_receiver *this = RECEIVER_THIS(object); |
| 42 | |
| 43 | if (!engineReceiverExists(this, Z_STRVAL_P(member))) { |
| 44 | // Value does not exist. |
| 45 | return 0; |
| 46 | } else if (check == 2) { |
| 47 | // Value exists. |
| 48 | return 1; |
| 49 | } |
| 50 | |
| 51 | int result = 0; |
| 52 | engine_value *val = engineReceiverGet(this, Z_STRVAL_P(member)); |
| 53 | |
| 54 | if (check == 1) { |
| 55 | // Value exists and is "truthy". |
| 56 | convert_to_boolean(val->internal); |
| 57 | result = VALUE_TRUTH(val->internal) ? 1 : 0; |
| 58 | } else if (check == 0) { |
| 59 | // Value exists and is not null. |
| 60 | result = (val->kind != KIND_NULL) ? 1 : 0; |
| 61 | } else { |
| 62 | // Check value is invalid. |
| 63 | result = 0; |
| 64 | } |
| 65 | |
| 66 | value_destroy(val); |
| 67 | return result; |
| 68 | } |
| 69 | |
| 70 | // Call function with arguments passed and return value (if any). |
| 71 | static int RECEIVER_METHOD_CALL(method) { |
nothing calls this directly
no test coverage detected