SourceModel.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. // This file is auto-generated, don't edit it. Thanks.
  3. namespace AlibabaCloud\OpenApiUtil\Tests\Models;
  4. use AlibabaCloud\Tea\Model;
  5. use GuzzleHttp\Psr7\Stream;
  6. class SourceModel extends Model {
  7. protected $_name = [
  8. 'test' => 'Test',
  9. 'empty' => 'empty',
  10. 'bodyObject' => 'body',
  11. 'listObject' => 'list',
  12. ];
  13. public function validate() {}
  14. public function toMap() {
  15. $res = [];
  16. if (null !== $this->test) {
  17. $res['Test'] = $this->test;
  18. }
  19. if (null !== $this->empty) {
  20. $res['empty'] = $this->empty;
  21. }
  22. if (null !== $this->bodyObject) {
  23. $res['body'] = $this->bodyObject;
  24. }
  25. if (null !== $this->listObject) {
  26. $res['list'] = $this->listObject;
  27. }
  28. if (null !== $this->urlListObject) {
  29. $res['urlList'] = [];
  30. if(null !== $this->urlListObject && is_array($this->urlListObject)){
  31. $n = 0;
  32. foreach($this->urlListObject as $item){
  33. $res['urlList'][$n++] = null !== $item ? $item->toMap() : $item;
  34. }
  35. }
  36. }
  37. return $res;
  38. }
  39. /**
  40. * @param array $map
  41. * @return SourceModel
  42. */
  43. public static function fromMap($map = []) {
  44. $model = new self();
  45. if(isset($map['Test'])){
  46. $model->test = $map['Test'];
  47. }
  48. if(isset($map['empty'])){
  49. $model->empty = $map['empty'];
  50. }
  51. if(isset($map['body'])){
  52. $model->bodyObject = $map['body'];
  53. }
  54. if(isset($map['list'])){
  55. if(!empty($map['list'])){
  56. $model->listObject = $map['list'];
  57. }
  58. }
  59. if(isset($map['urlList'])){
  60. if(!empty($map['urlList'])){
  61. $model->urlListObject = [];
  62. $n = 0;
  63. foreach($map['urlList'] as $item) {
  64. $model->urlListObject[$n++] = null !== $item ? urlListObject::fromMap($item) : $item;
  65. }
  66. }
  67. }
  68. return $model;
  69. }
  70. /**
  71. * @var string
  72. */
  73. public $test;
  74. /**
  75. * @var float
  76. */
  77. public $empty;
  78. /**
  79. * @var Stream
  80. */
  81. public $bodyObject;
  82. /**
  83. * @var Stream[]
  84. */
  85. public $listObject;
  86. public $urlListObject;
  87. }
  88. class urlListObject extends Model {
  89. protected $_name = [
  90. 'urlObject' => 'url',
  91. ];
  92. public function validate() {}
  93. public function toMap() {
  94. $res = [];
  95. if (null !== $this->urlObject) {
  96. $res['url'] = $this->urlObject;
  97. }
  98. return $res;
  99. }
  100. /**
  101. * @param array $map
  102. * @return urlListObject
  103. */
  104. public static function fromMap($map = []) {
  105. $model = new self();
  106. if(isset($map['url'])){
  107. $model->urlObject = $map['url'];
  108. }
  109. return $model;
  110. }
  111. /**
  112. * @var Stream
  113. */
  114. public $urlObject;
  115. }