function Message::writeWrapperValue
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ Message.php, line 175
Class
- Message
- Parent class of all proto messages. Users should not instantiate this class or extend this class or its child classes by their own. See the comment of specific functions for more details.
Namespace
Google\Protobuf\InternalCode
protected function writeWrapperValue($member, $value) {
$field = $this->desc
->getFieldByName($member);
$wrapped_value = $value;
if (!is_null($value)) {
$desc = $field->getMessageType();
$klass = $desc->getClass();
$wrapped_value = new $klass();
$wrapped_value->setValue($value);
}
$oneof_index = $field->getOneofIndex();
if ($oneof_index === -1) {
$this->{$member} = $wrapped_value;
}
else {
$this->writeOneof($field->getNumber(), $wrapped_value);
}
}