MCPcopy Create free account
hub / github.com/deuill/go-php / RECEIVER_EXISTS

Function RECEIVER_EXISTS

engine/receiver.c:40–68  ·  view source on GitHub ↗

Check if field exists for method receiver.

Source from the content-addressed store, hash-verified

38
39// Check if field exists for method receiver.
40static 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).
71static int RECEIVER_METHOD_CALL(method) {

Callers

nothing calls this directly

Calls 3

engineReceiverExistsFunction · 0.85
engineReceiverGetFunction · 0.85
value_destroyFunction · 0.50

Tested by

no test coverage detected