OccupiedOrderResponse.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?php
  2. /*
  3. * Copyright (c) 2008-2016 vip.com, All Rights Reserved.
  4. *
  5. * Powered by com.vip.osp.osp-idlc-2.5.11.
  6. *
  7. */
  8. namespace vipapis\order;
  9. class OccupiedOrderResponse {
  10. static $_TSPEC;
  11. public $has_next = null;
  12. public $occupied_orders = null;
  13. public function __construct($vals=null){
  14. if (!isset(self::$_TSPEC)){
  15. self::$_TSPEC = array(
  16. 1 => array(
  17. 'var' => 'has_next'
  18. ),
  19. 2 => array(
  20. 'var' => 'occupied_orders'
  21. ),
  22. );
  23. }
  24. if (is_array($vals)){
  25. if (isset($vals['has_next'])){
  26. $this->has_next = $vals['has_next'];
  27. }
  28. if (isset($vals['occupied_orders'])){
  29. $this->occupied_orders = $vals['occupied_orders'];
  30. }
  31. }
  32. }
  33. public function getName(){
  34. return 'OccupiedOrderResponse';
  35. }
  36. public function read($input){
  37. $input->readStructBegin();
  38. while(true){
  39. $schemeField = $input->readFieldBegin();
  40. if ($schemeField == null) break;
  41. $needSkip = true;
  42. if ("has_next" == $schemeField){
  43. $needSkip = false;
  44. $input->readBool($this->has_next);
  45. }
  46. if ("occupied_orders" == $schemeField){
  47. $needSkip = false;
  48. $this->occupied_orders = array();
  49. $_size1 = 0;
  50. $input->readListBegin();
  51. while(true){
  52. try{
  53. $elem1 = null;
  54. $elem1 = new \vipapis\order\OccupiedOrder();
  55. $elem1->read($input);
  56. $this->occupied_orders[$_size1++] = $elem1;
  57. }
  58. catch(\Exception $e){
  59. break;
  60. }
  61. }
  62. $input->readListEnd();
  63. }
  64. if($needSkip){
  65. \Osp\Protocol\ProtocolUtil::skip($input);
  66. }
  67. $input->readFieldEnd();
  68. }
  69. $input->readStructEnd();
  70. }
  71. public function write($output){
  72. $xfer = 0;
  73. $xfer += $output->writeStructBegin();
  74. $xfer += $output->writeFieldBegin('has_next');
  75. $xfer += $output->writeBool($this->has_next);
  76. $xfer += $output->writeFieldEnd();
  77. if($this->occupied_orders !== null) {
  78. $xfer += $output->writeFieldBegin('occupied_orders');
  79. if (!is_array($this->occupied_orders)){
  80. throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
  81. }
  82. $output->writeListBegin();
  83. foreach ($this->occupied_orders as $iter0){
  84. if (!is_object($iter0)) {
  85. throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
  86. }
  87. $xfer += $iter0->write($output);
  88. }
  89. $output->writeListEnd();
  90. $xfer += $output->writeFieldEnd();
  91. }
  92. $xfer += $output->writeFieldStop();
  93. $xfer += $output->writeStructEnd();
  94. return $xfer;
  95. }
  96. }
  97. ?>