Beispiel #1
0
 public static function setTestMessage(TestMessage $m)
 {
     $sub = new TestMessage_Sub();
     $m->setOptionalInt32(-42);
     $m->setOptionalInt64(-43);
     $m->setOptionalUint32(42);
     $m->setOptionalUint64(43);
     $m->setOptionalSint32(-44);
     $m->setOptionalSint64(-45);
     $m->setOptionalFixed32(46);
     $m->setOptionalFixed64(47);
     $m->setOptionalSfixed32(-46);
     $m->setOptionalSfixed64(-47);
     $m->setOptionalFloat(1.5);
     $m->setOptionalDouble(1.6);
     $m->setOptionalBool(true);
     $m->setOptionalString('a');
     $m->setOptionalBytes('b');
     $m->setOptionalEnum(TestEnum::ONE);
     $m->setOptionalMessage($sub);
     $m->getOptionalMessage()->SetA(33);
     $m->getRepeatedInt32()[] = -42;
     $m->getRepeatedInt64()[] = -43;
     $m->getRepeatedUint32()[] = 42;
     $m->getRepeatedUint64()[] = 43;
     $m->getRepeatedSint32()[] = -44;
     $m->getRepeatedSint64()[] = -45;
     $m->getRepeatedFixed32()[] = 46;
     $m->getRepeatedFixed64()[] = 47;
     $m->getRepeatedSfixed32()[] = -46;
     $m->getRepeatedSfixed64()[] = -47;
     $m->getRepeatedFloat()[] = 1.5;
     $m->getRepeatedDouble()[] = 1.6;
     $m->getRepeatedBool()[] = true;
     $m->getRepeatedString()[] = 'a';
     $m->getRepeatedBytes()[] = 'b';
     $m->getRepeatedEnum()[] = TestEnum::ZERO;
     $m->getRepeatedMessage()[] = new TestMessage_Sub();
     $m->getRepeatedMessage()[0]->setA(34);
     $m->getRepeatedInt32()[] = -52;
     $m->getRepeatedInt64()[] = -53;
     $m->getRepeatedUint32()[] = 52;
     $m->getRepeatedUint64()[] = 53;
     $m->getRepeatedSint32()[] = -54;
     $m->getRepeatedSint64()[] = -55;
     $m->getRepeatedFixed32()[] = 56;
     $m->getRepeatedFixed64()[] = 57;
     $m->getRepeatedSfixed32()[] = -56;
     $m->getRepeatedSfixed64()[] = -57;
     $m->getRepeatedFloat()[] = 2.5;
     $m->getRepeatedDouble()[] = 2.6;
     $m->getRepeatedBool()[] = false;
     $m->getRepeatedString()[] = 'c';
     $m->getRepeatedBytes()[] = 'd';
     $m->getRepeatedEnum()[] = TestEnum::ONE;
     $m->getRepeatedMessage()[] = new TestMessage_Sub();
     $m->getRepeatedMessage()[1]->SetA(35);
     $m->getMapInt32Int32()[-62] = -62;
     $m->getMapInt64Int64()[-63] = -63;
     $m->getMapUint32Uint32()[62] = 62;
     $m->getMapUint64Uint64()[63] = 63;
     $m->getMapSint32Sint32()[-64] = -64;
     $m->getMapSint64Sint64()[-65] = -65;
     $m->getMapFixed32Fixed32()[66] = 66;
     $m->getMapFixed64Fixed64()[67] = 67;
     $m->getMapInt32Float()[1] = 3.5;
     $m->getMapInt32Double()[1] = 3.6;
     $m->getMapBoolBool()[true] = true;
     $m->getMapStringString()['e'] = 'e';
     $m->getMapInt32Bytes()[1] = 'f';
     $m->getMapInt32Enum()[1] = TestEnum::ONE;
     $m->getMapInt32Message()[1] = new TestMessage_Sub();
     $m->getMapInt32Message()[1]->SetA(36);
 }