bool BaseVector::containskey(CVarRef key) { if (key.isInteger()) { return contains(key.toInt64()); } throwBadKeyType(); return false; }
Variant BaseVector::at(CVarRef key) { if (key.isInteger()) { return tvAsCVarRef(at(key.toInt64())); } throwBadKeyType(); return uninit_null(); }
TypedValue* BaseVector::OffsetGet(ObjectData* obj, TypedValue* key) { assert(key->m_type != KindOfRef); auto vec = static_cast<BaseVector*>(obj); if (key->m_type == KindOfInt64) { return vec->at(key->m_data.num); } throwBadKeyType(); return nullptr; }
bool BaseVector::OffsetContains(ObjectData* obj, TypedValue* key) { assert(key->m_type != KindOfRef); auto vec = static_cast<BaseVector*>(obj); if (key->m_type == KindOfInt64) { return vec->contains(key->m_data.num); } else { throwBadKeyType(); return false; } }
Variant BaseVector::get(CVarRef key) { if (key.isInteger()) { TypedValue* tv = get(key.toInt64()); if (tv) { return tvAsCVarRef(tv); } else { return uninit_null(); } } throwBadKeyType(); return uninit_null(); }
bool BaseVector::OffsetEmpty(ObjectData* obj, TypedValue* key) { assert(key->m_type != KindOfRef); auto vec = static_cast<BaseVector*>(obj); TypedValue* result; if (key->m_type == KindOfInt64) { result = vec->get(key->m_data.num); } else { throwBadKeyType(); result = nullptr; } return result ? !cellToBool(*result) : true; }
bool BaseVector::OffsetIsset(ObjectData* obj, TypedValue* key) { assert(key->m_type != KindOfRef); auto vec = static_cast<BaseVector*>(obj); TypedValue* result; if (key->m_type == KindOfInt64) { result = vec->get(key->m_data.num); } else { throwBadKeyType(); result = nullptr; } return result ? !tvIsNull(tvToCell(result)) : false; }
bool BaseMap::OffsetContains(ObjectData* obj, const TypedValue* key) { assert(key->m_type != KindOfRef); auto map = static_cast<BaseMap*>(obj); if (key->m_type == KindOfInt64) { return map->contains(key->m_data.num); } else if (isStringType(key->m_type)) { return map->contains(key->m_data.pstr); } else { throwBadKeyType(); return false; } }
void BaseMap::OffsetUnset(ObjectData* obj, const TypedValue* key) { assert(key->m_type != KindOfRef); auto map = static_cast<BaseMap*>(obj); if (key->m_type == KindOfInt64) { map->remove(key->m_data.num); return; } if (isStringType(key->m_type)) { map->remove(key->m_data.pstr); return; } throwBadKeyType(); }
bool BaseMap::OffsetEmpty(ObjectData* obj, const TypedValue* key) { assert(key->m_type != KindOfRef); auto map = static_cast<BaseMap*>(obj); TypedValue* result; if (key->m_type == KindOfInt64) { result = map->get(key->m_data.num); } else if (isStringType(key->m_type)) { result = map->get(key->m_data.pstr); } else { throwBadKeyType(); result = nullptr; } return result ? !cellToBool(*result) : true; }