Lines Matching defs:value
196 protected function writeWrapperValue($member, $value)
199 $wrapped_value = $value;
200 if (!is_null($value)) {
204 $wrapped_value->setValue($value);
237 protected function writeOneof($number, $value)
243 $oneof_field->setValue($value);
264 $value = null;
362 private static function parseFieldFromStreamNoTag($input, $field, &$value)
366 if (!GPBWire::readDouble($input, $value)) {
372 if (!GPBWire::readFloat($input, $value)) {
378 if (!GPBWire::readInt64($input, $value)) {
384 if (!GPBWire::readUint64($input, $value)) {
390 if (!GPBWire::readInt32($input, $value)) {
396 if (!GPBWire::readFixed64($input, $value)) {
402 if (!GPBWire::readFixed32($input, $value)) {
408 if (!GPBWire::readBool($input, $value)) {
415 if (!GPBWire::readString($input, $value)) {
425 $value = new MapEntry($field->getMessageType());
428 $value = new $klass;
430 if (!GPBWire::readMessage($input, $value)) {
436 if (!GPBWire::readString($input, $value)) {
442 if (!GPBWire::readUint32($input, $value)) {
448 // TODO(teboring): Check unknown enum value.
449 if (!GPBWire::readInt32($input, $value)) {
455 if (!GPBWire::readSfixed32($input, $value)) {
461 if (!GPBWire::readSfixed64($input, $value)) {
467 if (!GPBWire::readSint32($input, $value)) {
473 if (!GPBWire::readSint64($input, $value)) {
490 $value = null;
510 self::parseFieldFromStreamNoTag($input, $field, $value);
520 self::parseFieldFromStreamNoTag($input, $field, $value);
521 $this->appendHelper($field, $value);
530 $this->kvUpdateHelper($field, $value->getKey(), $value->getValue());
532 $this->appendHelper($field, $value);
535 $this->$setter($value);
667 foreach ($map as $key => $value) {
668 $value->discardUnknownFields();
692 * fields are appended. Map fields key-value pairs are overwritten.
712 foreach ($msg->$getter() as $key => $value) {
716 $copy->mergeFrom($value);
720 $this->kvUpdateHelper($field, $key, $value);
811 $value,
822 if (is_null($value)) {
824 } else if (!is_string($value)) {
827 return GPBUtil::parseDuration($value);
829 if (is_null($value)) {
831 } else if (!is_string($value)) {
835 $timestamp = GPBUtil::parseTimestamp($value);
844 if (is_null($value)) {
848 return GPBUtil::parseFieldMask($value);
854 if (is_null($value) &&
859 } elseif (!is_object($value) && !is_array($value)) {
862 $submsg->mergeFromJsonArray($value, $ignore_unknown);
866 if (is_null($value)) {
869 if (is_integer($value)) {
870 return $value;
872 $enum_value = $field->getEnumType()->getValueByName($value);
879 "Enum field only accepts integer or enum value name");
882 if (is_null($value)) {
885 if (is_numeric($value)) {
886 return strval($value);
888 if (!is_string($value)) {
890 "String field only accepts string value");
892 return $value;
894 if (is_null($value)) {
897 if (!is_string($value)) {
899 "Byte field only accepts string value");
901 $proto_value = base64_decode($value, true);
907 if (is_null($value)) {
911 if ($value === "true") {
914 if ($value === "false") {
918 "Bool field only accepts bool value");
920 if (!is_bool($value)) {
922 "Bool field only accepts bool value");
924 return $value;
927 if (is_null($value)) {
930 if ($value === "Infinity") {
933 if ($value === "-Infinity") {
936 if ($value === "NaN") {
939 return $value;
943 if (is_null($value)) {
946 if (!is_numeric($value)) {
950 if (is_string($value) && trim($value) !== $value) {
954 if (bccomp($value, "2147483647") > 0) {
958 if (bccomp($value, "-2147483648") < 0) {
962 return $value;
965 if (is_null($value)) {
968 if (!is_numeric($value)) {
972 if (is_string($value) && trim($value) !== $value) {
976 if (bccomp($value, 4294967295) > 0) {
980 return $value;
984 if (is_null($value)) {
987 if (!is_numeric($value)) {
991 if (is_string($value) && trim($value) !== $value) {
995 if (bccomp($value, "9223372036854775807") > 0) {
999 if (bccomp($value, "-9223372036854775808") < 0) {
1003 return $value;
1006 if (is_null($value)) {
1009 if (!is_numeric($value)) {
1013 if (is_string($value) && trim($value) !== $value) {
1017 if (bccomp($value, "18446744073709551615") > 0) {
1021 if (bccomp($value, "9223372036854775807") > 0) {
1022 $value = bcsub($value, "18446744073709551616");
1024 return $value;
1026 return $value;
1055 foreach ($array as $key => $value) {
1063 $valueField = $field->getMessageType()->getFieldByName('value');
1065 self::normalizeArrayElementsToMessageType($value, $valueField->getMessageType()->getClass());
1070 self::normalizeArrayElementsToMessageType($value, $class);
1072 self::normalizeToMessageType($value, $class);
1075 $this->$setter($value);
1080 * Tries to normalize the elements in $value into a provided protobuf
1081 * wrapper type $class. If $value is any type other than array, we do
1083 * type checking. If $value is an array, we process each element and
1086 * @param mixed $value The array of values to normalize.
1089 private static function normalizeArrayElementsToMessageType(&$value, $class)
1091 if (!is_array($value)) {
1092 // In the case that $value is not an array, we do not want to
1094 // when $value is a RepeatedField of MapField. In those cases,
1100 foreach ($value as $key => &$elementValue) {
1107 * Tries to normalize $value into a provided protobuf wrapper type $class.
1108 * If $value is any type other than an object, we attempt to construct an
1109 * instance of $class and assign $value to it using the setValue method
1115 * @param mixed $value The value to normalize.
1118 private static function normalizeToMessageType(&$value, $class)
1120 if (is_null($value) || is_object($value)) {
1121 // This handles the case that $value is an instance of $class. We
1126 // Try to instantiate $class and set the value
1129 $msg->setValue($value);
1130 $value = $msg;
1134 "Error normalizing value to type '$class': " . $exception->getMessage(),
1148 $msg->mergeFromJsonArray($array["value"], $ignore_unknown);
1185 foreach($array as $key => $value) {
1187 $v->mergeFromJsonArray($value, $ignore_unknown);
1209 $value = new Value();
1210 $value->mergeFromJsonArray($v, $ignore_unknown);
1212 $values[$key]= $value;
1222 $value = new Value();
1223 $value->mergeFromJsonArray($v, $ignore_unknown);
1225 $values[]= $value;
1238 foreach ($array as $key => $value) {
1247 if (is_null($value)) {
1252 foreach ($value as $tmp_key => $tmp_value) {
1255 "Map value field element cannot be null.");
1269 if (is_null($value)) {
1272 foreach ($value as $tmp) {
1286 $value,
1339 $value = $this->$getter();
1340 if (!GPBWire::serializeFieldToStream($value, $field, true, $output)) {
1366 foreach ($values as $value) {
1367 $size += $this->fieldDataOnlyByteSize($field, $value);
1374 foreach ($values as $value) {
1376 $value,
1398 foreach ($values as $key => $value) {
1401 $map_entry->setValue($value);
1469 // Serialize value
1471 $output->writeRaw(",\"value\":", 9);
1606 foreach ($values as $value) {
1615 private function fieldDataOnlyByteSize($field, $value)
1635 $size += GPBWire::varint32Size($value, true);
1638 $size += GPBWire::varint32Size($value);
1642 $size += GPBWire::varint64Size($value);
1645 $size += GPBWire::sint32Size($value);
1648 $size += GPBWire::sint64Size($value);
1652 $size += strlen($value);
1656 $size += $value->byteSize();
1674 private function fieldDataOnlyJsonByteSize($field, $value)
1682 $size += strlen(strval($value));
1686 if ($value < 0) {
1687 $value = bcadd($value, "4294967296");
1689 $size += strlen(strval($value));
1693 if ($value < 0) {
1694 $value = bcadd($value, "18446744073709551616");
1701 $size += strlen(strval($value));
1704 if (is_nan($value)) {
1706 } elseif ($value === INF) {
1708 } elseif ($value === -INF) {
1711 $size += strlen(sprintf("%.8g", $value));
1715 if (is_nan($value)) {
1717 } elseif ($value === INF) {
1719 } elseif ($value === -INF) {
1722 $size += strlen(sprintf("%.17g", $value));
1731 $enum_value_desc = $enum_desc->getValueByNumber($value);
1736 $str_value = strval($value);
1741 if ($value) {
1748 $value = json_encode($value, JSON_UNESCAPED_UNICODE);
1749 $size += strlen($value);
1753 # $size += strlen(json_encode($value));
1755 # $size += strlen(base64_encode($value));
1758 $size += strlen(base64_encode($value));
1762 $size += $value->jsonByteSize();
1791 foreach ($values as $key => $value) {
1799 if ($value != $this->defaultValue($value_field)) {
1802 $value);
1815 foreach ($values as $value) {
1816 $data_size += $this->fieldDataOnlyByteSize($field, $value);
1823 foreach ($values as $value) {
1824 $size += $this->fieldDataOnlyByteSize($field, $value);
1831 $value = $this->$getter();
1832 $size += $this->fieldDataOnlyByteSize($field, $value);
1871 foreach ($values as $key => $value) {
1876 $size += $this->fieldDataOnlyJsonByteSize($value_field, $value);
1892 foreach ($values as $value) {
1893 $size += $this->fieldDataOnlyJsonByteSize($field, $value);
1902 $value = $this->$getter();
1903 $size += $this->fieldDataOnlyJsonByteSize($field, $value);
1967 // Size for "\",value\":".
1971 // Size for value. +1 for comma, -2 for "{}".