1 <?php 2 // automatically generated by the FlatBuffers compiler, do not modify 3 4 namespace MyGame\Example; 5 6 use \Google\FlatBuffers\Struct; 7 use \Google\FlatBuffers\Table; 8 use \Google\FlatBuffers\ByteBuffer; 9 use \Google\FlatBuffers\FlatBufferBuilder; 10 11 /// an example documentation comment: monster object 12 class Monster extends Table 13 { 14 /** 15 * @param ByteBuffer $bb 16 * @return Monster 17 */ 18 public static function getRootAsMonster(ByteBuffer $bb) 19 { 20 $obj = new Monster(); 21 return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb)); 22 } 23 24 public static function MonsterIdentifier() 25 { 26 return "MONS"; 27 } 28 29 public static function MonsterBufferHasIdentifier(ByteBuffer $buf) 30 { 31 return self::__has_identifier($buf, self::MonsterIdentifier()); 32 } 33 34 public static function MonsterExtension() 35 { 36 return "mon"; 37 } 38 39 /** 40 * @param int $_i offset 41 * @param ByteBuffer $_bb 42 * @return Monster 43 **/ 44 public function init($_i, ByteBuffer $_bb) 45 { 46 $this->bb_pos = $_i; 47 $this->bb = $_bb; 48 return $this; 49 } 50 51 public function getPos() 52 { 53 $obj = new Vec3(); 54 $o = $this->__offset(4); 55 return $o != 0 ? $obj->init($o + $this->bb_pos, $this->bb) : 0; 56 } 57 58 /** 59 * @return short 60 */ 61 public function getMana() 62 { 63 $o = $this->__offset(6); 64 return $o != 0 ? $this->bb->getShort($o + $this->bb_pos) : 150; 65 } 66 67 /** 68 * @return short 69 */ 70 public function getHp() 71 { 72 $o = $this->__offset(8); 73 return $o != 0 ? $this->bb->getShort($o + $this->bb_pos) : 100; 74 } 75 76 public function getName() 77 { 78 $o = $this->__offset(10); 79 return $o != 0 ? $this->__string($o + $this->bb_pos) : null; 80 } 81 82 /** 83 * @param int offset 84 * @return byte 85 */ 86 public function getInventory($j) 87 { 88 $o = $this->__offset(14); 89 return $o != 0 ? $this->bb->getByte($this->__vector($o) + $j * 1) : 0; 90 } 91 92 /** 93 * @return int 94 */ 95 public function getInventoryLength() 96 { 97 $o = $this->__offset(14); 98 return $o != 0 ? $this->__vector_len($o) : 0; 99 } 100 101 /** 102 * @return string 103 */ 104 public function getInventoryBytes() 105 { 106 return $this->__vector_as_bytes(14); 107 } 108 109 /** 110 * @return sbyte 111 */ 112 public function getColor() 113 { 114 $o = $this->__offset(16); 115 return $o != 0 ? $this->bb->getSbyte($o + $this->bb_pos) : \MyGame\Example\Color::Blue; 116 } 117 118 /** 119 * @return byte 120 */ 121 public function getTestType() 122 { 123 $o = $this->__offset(18); 124 return $o != 0 ? $this->bb->getByte($o + $this->bb_pos) : \MyGame\Example\Any::NONE; 125 } 126 127 /** 128 * @returnint 129 */ 130 public function getTest($obj) 131 { 132 $o = $this->__offset(20); 133 return $o != 0 ? $this->__union($obj, $o) : null; 134 } 135 136 /** 137 * @returnVectorOffset 138 */ 139 public function getTest4($j) 140 { 141 $o = $this->__offset(22); 142 $obj = new Test(); 143 return $o != 0 ? $obj->init($this->__vector($o) + $j *4, $this->bb) : null; 144 } 145 146 /** 147 * @return int 148 */ 149 public function getTest4Length() 150 { 151 $o = $this->__offset(22); 152 return $o != 0 ? $this->__vector_len($o) : 0; 153 } 154 155 /** 156 * @param int offset 157 * @return string 158 */ 159 public function getTestarrayofstring($j) 160 { 161 $o = $this->__offset(24); 162 return $o != 0 ? $this->__string($this->__vector($o) + $j * 4) : 0; 163 } 164 165 /** 166 * @return int 167 */ 168 public function getTestarrayofstringLength() 169 { 170 $o = $this->__offset(24); 171 return $o != 0 ? $this->__vector_len($o) : 0; 172 } 173 174 /// an example documentation comment: this will end up in the generated code 175 /// multiline too 176 /** 177 * @returnVectorOffset 178 */ 179 public function getTestarrayoftables($j) 180 { 181 $o = $this->__offset(26); 182 $obj = new Monster(); 183 return $o != 0 ? $obj->init($this->__indirect($this->__vector($o) + $j * 4), $this->bb) : null; 184 } 185 186 /** 187 * @return int 188 */ 189 public function getTestarrayoftablesLength() 190 { 191 $o = $this->__offset(26); 192 return $o != 0 ? $this->__vector_len($o) : 0; 193 } 194 195 public function getEnemy() 196 { 197 $obj = new Monster(); 198 $o = $this->__offset(28); 199 return $o != 0 ? $obj->init($this->__indirect($o + $this->bb_pos), $this->bb) : 0; 200 } 201 202 /** 203 * @param int offset 204 * @return byte 205 */ 206 public function getTestnestedflatbuffer($j) 207 { 208 $o = $this->__offset(30); 209 return $o != 0 ? $this->bb->getByte($this->__vector($o) + $j * 1) : 0; 210 } 211 212 /** 213 * @return int 214 */ 215 public function getTestnestedflatbufferLength() 216 { 217 $o = $this->__offset(30); 218 return $o != 0 ? $this->__vector_len($o) : 0; 219 } 220 221 /** 222 * @return string 223 */ 224 public function getTestnestedflatbufferBytes() 225 { 226 return $this->__vector_as_bytes(30); 227 } 228 229 public function getTestempty() 230 { 231 $obj = new Stat(); 232 $o = $this->__offset(32); 233 return $o != 0 ? $obj->init($this->__indirect($o + $this->bb_pos), $this->bb) : 0; 234 } 235 236 /** 237 * @return bool 238 */ 239 public function getTestbool() 240 { 241 $o = $this->__offset(34); 242 return $o != 0 ? $this->bb->getBool($o + $this->bb_pos) : false; 243 } 244 245 /** 246 * @return int 247 */ 248 public function getTesthashs32Fnv1() 249 { 250 $o = $this->__offset(36); 251 return $o != 0 ? $this->bb->getInt($o + $this->bb_pos) : 0; 252 } 253 254 /** 255 * @return uint 256 */ 257 public function getTesthashu32Fnv1() 258 { 259 $o = $this->__offset(38); 260 return $o != 0 ? $this->bb->getUint($o + $this->bb_pos) : 0; 261 } 262 263 /** 264 * @return long 265 */ 266 public function getTesthashs64Fnv1() 267 { 268 $o = $this->__offset(40); 269 return $o != 0 ? $this->bb->getLong($o + $this->bb_pos) : 0; 270 } 271 272 /** 273 * @return ulong 274 */ 275 public function getTesthashu64Fnv1() 276 { 277 $o = $this->__offset(42); 278 return $o != 0 ? $this->bb->getUlong($o + $this->bb_pos) : 0; 279 } 280 281 /** 282 * @return int 283 */ 284 public function getTesthashs32Fnv1a() 285 { 286 $o = $this->__offset(44); 287 return $o != 0 ? $this->bb->getInt($o + $this->bb_pos) : 0; 288 } 289 290 /** 291 * @return uint 292 */ 293 public function getTesthashu32Fnv1a() 294 { 295 $o = $this->__offset(46); 296 return $o != 0 ? $this->bb->getUint($o + $this->bb_pos) : 0; 297 } 298 299 /** 300 * @return long 301 */ 302 public function getTesthashs64Fnv1a() 303 { 304 $o = $this->__offset(48); 305 return $o != 0 ? $this->bb->getLong($o + $this->bb_pos) : 0; 306 } 307 308 /** 309 * @return ulong 310 */ 311 public function getTesthashu64Fnv1a() 312 { 313 $o = $this->__offset(50); 314 return $o != 0 ? $this->bb->getUlong($o + $this->bb_pos) : 0; 315 } 316 317 /** 318 * @param int offset 319 * @return bool 320 */ 321 public function getTestarrayofbools($j) 322 { 323 $o = $this->__offset(52); 324 return $o != 0 ? $this->bb->getBool($this->__vector($o) + $j * 1) : 0; 325 } 326 327 /** 328 * @return int 329 */ 330 public function getTestarrayofboolsLength() 331 { 332 $o = $this->__offset(52); 333 return $o != 0 ? $this->__vector_len($o) : 0; 334 } 335 336 /** 337 * @return float 338 */ 339 public function getTestf() 340 { 341 $o = $this->__offset(54); 342 return $o != 0 ? $this->bb->getFloat($o + $this->bb_pos) : 3.14159; 343 } 344 345 /** 346 * @return float 347 */ 348 public function getTestf2() 349 { 350 $o = $this->__offset(56); 351 return $o != 0 ? $this->bb->getFloat($o + $this->bb_pos) : 3.0; 352 } 353 354 /** 355 * @return float 356 */ 357 public function getTestf3() 358 { 359 $o = $this->__offset(58); 360 return $o != 0 ? $this->bb->getFloat($o + $this->bb_pos) : 0.0; 361 } 362 363 /** 364 * @param int offset 365 * @return string 366 */ 367 public function getTestarrayofstring2($j) 368 { 369 $o = $this->__offset(60); 370 return $o != 0 ? $this->__string($this->__vector($o) + $j * 4) : 0; 371 } 372 373 /** 374 * @return int 375 */ 376 public function getTestarrayofstring2Length() 377 { 378 $o = $this->__offset(60); 379 return $o != 0 ? $this->__vector_len($o) : 0; 380 } 381 382 /** 383 * @param FlatBufferBuilder $builder 384 * @return void 385 */ 386 public static function startMonster(FlatBufferBuilder $builder) 387 { 388 $builder->StartObject(29); 389 } 390 391 /** 392 * @param FlatBufferBuilder $builder 393 * @return Monster 394 */ 395 public static function createMonster(FlatBufferBuilder $builder, $pos, $mana, $hp, $name, $inventory, $color, $test_type, $test, $test4, $testarrayofstring, $testarrayoftables, $enemy, $testnestedflatbuffer, $testempty, $testbool, $testhashs32_fnv1, $testhashu32_fnv1, $testhashs64_fnv1, $testhashu64_fnv1, $testhashs32_fnv1a, $testhashu32_fnv1a, $testhashs64_fnv1a, $testhashu64_fnv1a, $testarrayofbools, $testf, $testf2, $testf3, $testarrayofstring2) 396 { 397 $builder->startObject(29); 398 self::addPos($builder, $pos); 399 self::addMana($builder, $mana); 400 self::addHp($builder, $hp); 401 self::addName($builder, $name); 402 self::addInventory($builder, $inventory); 403 self::addColor($builder, $color); 404 self::addTestType($builder, $test_type); 405 self::addTest($builder, $test); 406 self::addTest4($builder, $test4); 407 self::addTestarrayofstring($builder, $testarrayofstring); 408 self::addTestarrayoftables($builder, $testarrayoftables); 409 self::addEnemy($builder, $enemy); 410 self::addTestnestedflatbuffer($builder, $testnestedflatbuffer); 411 self::addTestempty($builder, $testempty); 412 self::addTestbool($builder, $testbool); 413 self::addTesthashs32Fnv1($builder, $testhashs32_fnv1); 414 self::addTesthashu32Fnv1($builder, $testhashu32_fnv1); 415 self::addTesthashs64Fnv1($builder, $testhashs64_fnv1); 416 self::addTesthashu64Fnv1($builder, $testhashu64_fnv1); 417 self::addTesthashs32Fnv1a($builder, $testhashs32_fnv1a); 418 self::addTesthashu32Fnv1a($builder, $testhashu32_fnv1a); 419 self::addTesthashs64Fnv1a($builder, $testhashs64_fnv1a); 420 self::addTesthashu64Fnv1a($builder, $testhashu64_fnv1a); 421 self::addTestarrayofbools($builder, $testarrayofbools); 422 self::addTestf($builder, $testf); 423 self::addTestf2($builder, $testf2); 424 self::addTestf3($builder, $testf3); 425 self::addTestarrayofstring2($builder, $testarrayofstring2); 426 $o = $builder->endObject(); 427 $builder->required($o, 10); // name 428 return $o; 429 } 430 431 /** 432 * @param FlatBufferBuilder $builder 433 * @param int 434 * @return void 435 */ 436 public static function addPos(FlatBufferBuilder $builder, $pos) 437 { 438 $builder->addStructX(0, $pos, 0); 439 } 440 441 /** 442 * @param FlatBufferBuilder $builder 443 * @param short 444 * @return void 445 */ 446 public static function addMana(FlatBufferBuilder $builder, $mana) 447 { 448 $builder->addShortX(1, $mana, 150); 449 } 450 451 /** 452 * @param FlatBufferBuilder $builder 453 * @param short 454 * @return void 455 */ 456 public static function addHp(FlatBufferBuilder $builder, $hp) 457 { 458 $builder->addShortX(2, $hp, 100); 459 } 460 461 /** 462 * @param FlatBufferBuilder $builder 463 * @param StringOffset 464 * @return void 465 */ 466 public static function addName(FlatBufferBuilder $builder, $name) 467 { 468 $builder->addOffsetX(3, $name, 0); 469 } 470 471 /** 472 * @param FlatBufferBuilder $builder 473 * @param VectorOffset 474 * @return void 475 */ 476 public static function addInventory(FlatBufferBuilder $builder, $inventory) 477 { 478 $builder->addOffsetX(5, $inventory, 0); 479 } 480 481 /** 482 * @param FlatBufferBuilder $builder 483 * @param array offset array 484 * @return int vector offset 485 */ 486 public static function createInventoryVector(FlatBufferBuilder $builder, array $data) 487 { 488 $builder->startVector(1, count($data), 1); 489 for ($i = count($data) - 1; $i >= 0; $i--) { 490 $builder->addByte($data[$i]); 491 } 492 return $builder->endVector(); 493 } 494 495 /** 496 * @param FlatBufferBuilder $builder 497 * @param int $numElems 498 * @return void 499 */ 500 public static function startInventoryVector(FlatBufferBuilder $builder, $numElems) 501 { 502 $builder->startVector(1, $numElems, 1); 503 } 504 505 /** 506 * @param FlatBufferBuilder $builder 507 * @param sbyte 508 * @return void 509 */ 510 public static function addColor(FlatBufferBuilder $builder, $color) 511 { 512 $builder->addSbyteX(6, $color, 8); 513 } 514 515 /** 516 * @param FlatBufferBuilder $builder 517 * @param byte 518 * @return void 519 */ 520 public static function addTestType(FlatBufferBuilder $builder, $testType) 521 { 522 $builder->addByteX(7, $testType, 0); 523 } 524 525 public static function addTest(FlatBufferBuilder $builder, $offset) 526 { 527 $builder->addOffsetX(8, $offset, 0); 528 } 529 530 /** 531 * @param FlatBufferBuilder $builder 532 * @param VectorOffset 533 * @return void 534 */ 535 public static function addTest4(FlatBufferBuilder $builder, $test4) 536 { 537 $builder->addOffsetX(9, $test4, 0); 538 } 539 540 /** 541 * @param FlatBufferBuilder $builder 542 * @param array offset array 543 * @return int vector offset 544 */ 545 public static function createTest4Vector(FlatBufferBuilder $builder, array $data) 546 { 547 $builder->startVector(4, count($data), 2); 548 for ($i = count($data) - 1; $i >= 0; $i--) { 549 $builder->addOffset($data[$i]); 550 } 551 return $builder->endVector(); 552 } 553 554 /** 555 * @param FlatBufferBuilder $builder 556 * @param int $numElems 557 * @return void 558 */ 559 public static function startTest4Vector(FlatBufferBuilder $builder, $numElems) 560 { 561 $builder->startVector(4, $numElems, 2); 562 } 563 564 /** 565 * @param FlatBufferBuilder $builder 566 * @param VectorOffset 567 * @return void 568 */ 569 public static function addTestarrayofstring(FlatBufferBuilder $builder, $testarrayofstring) 570 { 571 $builder->addOffsetX(10, $testarrayofstring, 0); 572 } 573 574 /** 575 * @param FlatBufferBuilder $builder 576 * @param array offset array 577 * @return int vector offset 578 */ 579 public static function createTestarrayofstringVector(FlatBufferBuilder $builder, array $data) 580 { 581 $builder->startVector(4, count($data), 4); 582 for ($i = count($data) - 1; $i >= 0; $i--) { 583 $builder->addOffset($data[$i]); 584 } 585 return $builder->endVector(); 586 } 587 588 /** 589 * @param FlatBufferBuilder $builder 590 * @param int $numElems 591 * @return void 592 */ 593 public static function startTestarrayofstringVector(FlatBufferBuilder $builder, $numElems) 594 { 595 $builder->startVector(4, $numElems, 4); 596 } 597 598 /** 599 * @param FlatBufferBuilder $builder 600 * @param VectorOffset 601 * @return void 602 */ 603 public static function addTestarrayoftables(FlatBufferBuilder $builder, $testarrayoftables) 604 { 605 $builder->addOffsetX(11, $testarrayoftables, 0); 606 } 607 608 /** 609 * @param FlatBufferBuilder $builder 610 * @param array offset array 611 * @return int vector offset 612 */ 613 public static function createTestarrayoftablesVector(FlatBufferBuilder $builder, array $data) 614 { 615 $builder->startVector(4, count($data), 4); 616 for ($i = count($data) - 1; $i >= 0; $i--) { 617 $builder->addOffset($data[$i]); 618 } 619 return $builder->endVector(); 620 } 621 622 /** 623 * @param FlatBufferBuilder $builder 624 * @param int $numElems 625 * @return void 626 */ 627 public static function startTestarrayoftablesVector(FlatBufferBuilder $builder, $numElems) 628 { 629 $builder->startVector(4, $numElems, 4); 630 } 631 632 /** 633 * @param FlatBufferBuilder $builder 634 * @param int 635 * @return void 636 */ 637 public static function addEnemy(FlatBufferBuilder $builder, $enemy) 638 { 639 $builder->addOffsetX(12, $enemy, 0); 640 } 641 642 /** 643 * @param FlatBufferBuilder $builder 644 * @param VectorOffset 645 * @return void 646 */ 647 public static function addTestnestedflatbuffer(FlatBufferBuilder $builder, $testnestedflatbuffer) 648 { 649 $builder->addOffsetX(13, $testnestedflatbuffer, 0); 650 } 651 652 /** 653 * @param FlatBufferBuilder $builder 654 * @param array offset array 655 * @return int vector offset 656 */ 657 public static function createTestnestedflatbufferVector(FlatBufferBuilder $builder, array $data) 658 { 659 $builder->startVector(1, count($data), 1); 660 for ($i = count($data) - 1; $i >= 0; $i--) { 661 $builder->addByte($data[$i]); 662 } 663 return $builder->endVector(); 664 } 665 666 /** 667 * @param FlatBufferBuilder $builder 668 * @param int $numElems 669 * @return void 670 */ 671 public static function startTestnestedflatbufferVector(FlatBufferBuilder $builder, $numElems) 672 { 673 $builder->startVector(1, $numElems, 1); 674 } 675 676 /** 677 * @param FlatBufferBuilder $builder 678 * @param int 679 * @return void 680 */ 681 public static function addTestempty(FlatBufferBuilder $builder, $testempty) 682 { 683 $builder->addOffsetX(14, $testempty, 0); 684 } 685 686 /** 687 * @param FlatBufferBuilder $builder 688 * @param bool 689 * @return void 690 */ 691 public static function addTestbool(FlatBufferBuilder $builder, $testbool) 692 { 693 $builder->addBoolX(15, $testbool, false); 694 } 695 696 /** 697 * @param FlatBufferBuilder $builder 698 * @param int 699 * @return void 700 */ 701 public static function addTesthashs32Fnv1(FlatBufferBuilder $builder, $testhashs32Fnv1) 702 { 703 $builder->addIntX(16, $testhashs32Fnv1, 0); 704 } 705 706 /** 707 * @param FlatBufferBuilder $builder 708 * @param uint 709 * @return void 710 */ 711 public static function addTesthashu32Fnv1(FlatBufferBuilder $builder, $testhashu32Fnv1) 712 { 713 $builder->addUintX(17, $testhashu32Fnv1, 0); 714 } 715 716 /** 717 * @param FlatBufferBuilder $builder 718 * @param long 719 * @return void 720 */ 721 public static function addTesthashs64Fnv1(FlatBufferBuilder $builder, $testhashs64Fnv1) 722 { 723 $builder->addLongX(18, $testhashs64Fnv1, 0); 724 } 725 726 /** 727 * @param FlatBufferBuilder $builder 728 * @param ulong 729 * @return void 730 */ 731 public static function addTesthashu64Fnv1(FlatBufferBuilder $builder, $testhashu64Fnv1) 732 { 733 $builder->addUlongX(19, $testhashu64Fnv1, 0); 734 } 735 736 /** 737 * @param FlatBufferBuilder $builder 738 * @param int 739 * @return void 740 */ 741 public static function addTesthashs32Fnv1a(FlatBufferBuilder $builder, $testhashs32Fnv1a) 742 { 743 $builder->addIntX(20, $testhashs32Fnv1a, 0); 744 } 745 746 /** 747 * @param FlatBufferBuilder $builder 748 * @param uint 749 * @return void 750 */ 751 public static function addTesthashu32Fnv1a(FlatBufferBuilder $builder, $testhashu32Fnv1a) 752 { 753 $builder->addUintX(21, $testhashu32Fnv1a, 0); 754 } 755 756 /** 757 * @param FlatBufferBuilder $builder 758 * @param long 759 * @return void 760 */ 761 public static function addTesthashs64Fnv1a(FlatBufferBuilder $builder, $testhashs64Fnv1a) 762 { 763 $builder->addLongX(22, $testhashs64Fnv1a, 0); 764 } 765 766 /** 767 * @param FlatBufferBuilder $builder 768 * @param ulong 769 * @return void 770 */ 771 public static function addTesthashu64Fnv1a(FlatBufferBuilder $builder, $testhashu64Fnv1a) 772 { 773 $builder->addUlongX(23, $testhashu64Fnv1a, 0); 774 } 775 776 /** 777 * @param FlatBufferBuilder $builder 778 * @param VectorOffset 779 * @return void 780 */ 781 public static function addTestarrayofbools(FlatBufferBuilder $builder, $testarrayofbools) 782 { 783 $builder->addOffsetX(24, $testarrayofbools, 0); 784 } 785 786 /** 787 * @param FlatBufferBuilder $builder 788 * @param array offset array 789 * @return int vector offset 790 */ 791 public static function createTestarrayofboolsVector(FlatBufferBuilder $builder, array $data) 792 { 793 $builder->startVector(1, count($data), 1); 794 for ($i = count($data) - 1; $i >= 0; $i--) { 795 $builder->addBool($data[$i]); 796 } 797 return $builder->endVector(); 798 } 799 800 /** 801 * @param FlatBufferBuilder $builder 802 * @param int $numElems 803 * @return void 804 */ 805 public static function startTestarrayofboolsVector(FlatBufferBuilder $builder, $numElems) 806 { 807 $builder->startVector(1, $numElems, 1); 808 } 809 810 /** 811 * @param FlatBufferBuilder $builder 812 * @param float 813 * @return void 814 */ 815 public static function addTestf(FlatBufferBuilder $builder, $testf) 816 { 817 $builder->addFloatX(25, $testf, 3.14159); 818 } 819 820 /** 821 * @param FlatBufferBuilder $builder 822 * @param float 823 * @return void 824 */ 825 public static function addTestf2(FlatBufferBuilder $builder, $testf2) 826 { 827 $builder->addFloatX(26, $testf2, 3.0); 828 } 829 830 /** 831 * @param FlatBufferBuilder $builder 832 * @param float 833 * @return void 834 */ 835 public static function addTestf3(FlatBufferBuilder $builder, $testf3) 836 { 837 $builder->addFloatX(27, $testf3, 0.0); 838 } 839 840 /** 841 * @param FlatBufferBuilder $builder 842 * @param VectorOffset 843 * @return void 844 */ 845 public static function addTestarrayofstring2(FlatBufferBuilder $builder, $testarrayofstring2) 846 { 847 $builder->addOffsetX(28, $testarrayofstring2, 0); 848 } 849 850 /** 851 * @param FlatBufferBuilder $builder 852 * @param array offset array 853 * @return int vector offset 854 */ 855 public static function createTestarrayofstring2Vector(FlatBufferBuilder $builder, array $data) 856 { 857 $builder->startVector(4, count($data), 4); 858 for ($i = count($data) - 1; $i >= 0; $i--) { 859 $builder->addOffset($data[$i]); 860 } 861 return $builder->endVector(); 862 } 863 864 /** 865 * @param FlatBufferBuilder $builder 866 * @param int $numElems 867 * @return void 868 */ 869 public static function startTestarrayofstring2Vector(FlatBufferBuilder $builder, $numElems) 870 { 871 $builder->startVector(4, $numElems, 4); 872 } 873 874 /** 875 * @param FlatBufferBuilder $builder 876 * @return int table offset 877 */ 878 public static function endMonster(FlatBufferBuilder $builder) 879 { 880 $o = $builder->endObject(); 881 $builder->required($o, 10); // name 882 return $o; 883 } 884 885 public static function finishMonsterBuffer(FlatBufferBuilder $builder, $offset) 886 { 887 $builder->finish($offset, "MONS"); 888 } 889 } 890