PageRenderTime 46ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/ext-libs/Protobuf-PHP/tests/protos/addressbook.php

https://gitlab.com/billyprice1/app-download.org
PHP | 456 lines | 196 code | 69 blank | 191 comment | 0 complexity | 5736edbe14c4dc837d1ebaf0faca79ef MD5 | raw file
  1. <?php
  2. // DO NOT EDIT! Generated by Protobuf-PHP protoc plugin @package_version@
  3. // Source: addressbook.proto
  4. // Date: 2011-10-04 14:32:12
  5. namespace tests\Person {
  6. class PhoneType extends \DrSlump\Protobuf\Enum {
  7. const MOBILE = 0;
  8. const HOME = 1;
  9. const WORK = 2;
  10. }
  11. }
  12. namespace tests\Person {
  13. class PhoneNumber extends \DrSlump\Protobuf\Message {
  14. /** @var string */
  15. public $number = null;
  16. /** @var int - \tests\Person\PhoneType */
  17. public $type = \tests\Person\PhoneType::HOME;
  18. /** @var \Closure[] */
  19. protected static $__extensions = array();
  20. public static function descriptor()
  21. {
  22. $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'tests.Person.PhoneNumber');
  23. // REQUIRED STRING number = 1
  24. $f = new \DrSlump\Protobuf\Field();
  25. $f->number = 1;
  26. $f->name = "number";
  27. $f->type = \DrSlump\Protobuf::TYPE_STRING;
  28. $f->rule = \DrSlump\Protobuf::RULE_REQUIRED;
  29. $descriptor->addField($f);
  30. // OPTIONAL ENUM type = 2
  31. $f = new \DrSlump\Protobuf\Field();
  32. $f->number = 2;
  33. $f->name = "type";
  34. $f->type = \DrSlump\Protobuf::TYPE_ENUM;
  35. $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
  36. $f->reference = '\tests\Person\PhoneType';
  37. $f->default = \tests\Person\PhoneType::HOME;
  38. $descriptor->addField($f);
  39. foreach (self::$__extensions as $cb) {
  40. $descriptor->addField($cb(), true);
  41. }
  42. return $descriptor;
  43. }
  44. /**
  45. * Check if <number> has a value
  46. *
  47. * @return boolean
  48. */
  49. public function hasNumber(){
  50. return $this->_has(1);
  51. }
  52. /**
  53. * Clear <number> value
  54. *
  55. * @return \tests\Person\PhoneNumber
  56. */
  57. public function clearNumber(){
  58. return $this->_clear(1);
  59. }
  60. /**
  61. * Get <number> value
  62. *
  63. * @return string
  64. */
  65. public function getNumber(){
  66. return $this->_get(1);
  67. }
  68. /**
  69. * Set <number> value
  70. *
  71. * @param string $value
  72. * @return \tests\Person\PhoneNumber
  73. */
  74. public function setNumber( $value){
  75. return $this->_set(1, $value);
  76. }
  77. /**
  78. * Check if <type> has a value
  79. *
  80. * @return boolean
  81. */
  82. public function hasType(){
  83. return $this->_has(2);
  84. }
  85. /**
  86. * Clear <type> value
  87. *
  88. * @return \tests\Person\PhoneNumber
  89. */
  90. public function clearType(){
  91. return $this->_clear(2);
  92. }
  93. /**
  94. * Get <type> value
  95. *
  96. * @return int - \tests\Person\PhoneType
  97. */
  98. public function getType(){
  99. return $this->_get(2);
  100. }
  101. /**
  102. * Set <type> value
  103. *
  104. * @param int - \tests\Person\PhoneType $value
  105. * @return \tests\Person\PhoneNumber
  106. */
  107. public function setType( $value){
  108. return $this->_set(2, $value);
  109. }
  110. }
  111. }
  112. namespace tests {
  113. class Person extends \DrSlump\Protobuf\Message {
  114. /** @var string */
  115. public $name = null;
  116. /** @var int */
  117. public $id = null;
  118. /** @var string */
  119. public $email = null;
  120. /** @var \tests\Person\PhoneNumber[] */
  121. public $phone = array();
  122. /** @var \Closure[] */
  123. protected static $__extensions = array();
  124. public static function descriptor()
  125. {
  126. $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'tests.Person');
  127. // REQUIRED STRING name = 1
  128. $f = new \DrSlump\Protobuf\Field();
  129. $f->number = 1;
  130. $f->name = "name";
  131. $f->type = \DrSlump\Protobuf::TYPE_STRING;
  132. $f->rule = \DrSlump\Protobuf::RULE_REQUIRED;
  133. $descriptor->addField($f);
  134. // REQUIRED INT32 id = 2
  135. $f = new \DrSlump\Protobuf\Field();
  136. $f->number = 2;
  137. $f->name = "id";
  138. $f->type = \DrSlump\Protobuf::TYPE_INT32;
  139. $f->rule = \DrSlump\Protobuf::RULE_REQUIRED;
  140. $descriptor->addField($f);
  141. // OPTIONAL STRING email = 3
  142. $f = new \DrSlump\Protobuf\Field();
  143. $f->number = 3;
  144. $f->name = "email";
  145. $f->type = \DrSlump\Protobuf::TYPE_STRING;
  146. $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
  147. $descriptor->addField($f);
  148. // REPEATED MESSAGE phone = 4
  149. $f = new \DrSlump\Protobuf\Field();
  150. $f->number = 4;
  151. $f->name = "phone";
  152. $f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
  153. $f->rule = \DrSlump\Protobuf::RULE_REPEATED;
  154. $f->reference = '\tests\Person\PhoneNumber';
  155. $descriptor->addField($f);
  156. foreach (self::$__extensions as $cb) {
  157. $descriptor->addField($cb(), true);
  158. }
  159. return $descriptor;
  160. }
  161. /**
  162. * Check if <name> has a value
  163. *
  164. * @return boolean
  165. */
  166. public function hasName(){
  167. return $this->_has(1);
  168. }
  169. /**
  170. * Clear <name> value
  171. *
  172. * @return \tests\Person
  173. */
  174. public function clearName(){
  175. return $this->_clear(1);
  176. }
  177. /**
  178. * Get <name> value
  179. *
  180. * @return string
  181. */
  182. public function getName(){
  183. return $this->_get(1);
  184. }
  185. /**
  186. * Set <name> value
  187. *
  188. * @param string $value
  189. * @return \tests\Person
  190. */
  191. public function setName( $value){
  192. return $this->_set(1, $value);
  193. }
  194. /**
  195. * Check if <id> has a value
  196. *
  197. * @return boolean
  198. */
  199. public function hasId(){
  200. return $this->_has(2);
  201. }
  202. /**
  203. * Clear <id> value
  204. *
  205. * @return \tests\Person
  206. */
  207. public function clearId(){
  208. return $this->_clear(2);
  209. }
  210. /**
  211. * Get <id> value
  212. *
  213. * @return int
  214. */
  215. public function getId(){
  216. return $this->_get(2);
  217. }
  218. /**
  219. * Set <id> value
  220. *
  221. * @param int $value
  222. * @return \tests\Person
  223. */
  224. public function setId( $value){
  225. return $this->_set(2, $value);
  226. }
  227. /**
  228. * Check if <email> has a value
  229. *
  230. * @return boolean
  231. */
  232. public function hasEmail(){
  233. return $this->_has(3);
  234. }
  235. /**
  236. * Clear <email> value
  237. *
  238. * @return \tests\Person
  239. */
  240. public function clearEmail(){
  241. return $this->_clear(3);
  242. }
  243. /**
  244. * Get <email> value
  245. *
  246. * @return string
  247. */
  248. public function getEmail(){
  249. return $this->_get(3);
  250. }
  251. /**
  252. * Set <email> value
  253. *
  254. * @param string $value
  255. * @return \tests\Person
  256. */
  257. public function setEmail( $value){
  258. return $this->_set(3, $value);
  259. }
  260. /**
  261. * Check if <phone> has a value
  262. *
  263. * @return boolean
  264. */
  265. public function hasPhone(){
  266. return $this->_has(4);
  267. }
  268. /**
  269. * Clear <phone> value
  270. *
  271. * @return \tests\Person
  272. */
  273. public function clearPhone(){
  274. return $this->_clear(4);
  275. }
  276. /**
  277. * Get <phone> value
  278. *
  279. * @param int $idx
  280. * @return \tests\Person\PhoneNumber
  281. */
  282. public function getPhone($idx = NULL){
  283. return $this->_get(4, $idx);
  284. }
  285. /**
  286. * Set <phone> value
  287. *
  288. * @param \tests\Person\PhoneNumber $value
  289. * @return \tests\Person
  290. */
  291. public function setPhone(\tests\Person\PhoneNumber $value, $idx = NULL){
  292. return $this->_set(4, $value, $idx);
  293. }
  294. /**
  295. * Get all elements of <phone>
  296. *
  297. * @return \tests\Person\PhoneNumber[]
  298. */
  299. public function getPhoneList(){
  300. return $this->_get(4);
  301. }
  302. /**
  303. * Add a new element to <phone>
  304. *
  305. * @param \tests\Person\PhoneNumber $value
  306. * @return \tests\Person
  307. */
  308. public function addPhone(\tests\Person\PhoneNumber $value){
  309. return $this->_add(4, $value);
  310. }
  311. }
  312. }
  313. namespace tests {
  314. class AddressBook extends \DrSlump\Protobuf\Message {
  315. /** @var \tests\Person[] */
  316. public $person = array();
  317. /** @var \Closure[] */
  318. protected static $__extensions = array();
  319. public static function descriptor()
  320. {
  321. $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'tests.AddressBook');
  322. // REPEATED MESSAGE person = 1
  323. $f = new \DrSlump\Protobuf\Field();
  324. $f->number = 1;
  325. $f->name = "person";
  326. $f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
  327. $f->rule = \DrSlump\Protobuf::RULE_REPEATED;
  328. $f->reference = '\tests\Person';
  329. $descriptor->addField($f);
  330. foreach (self::$__extensions as $cb) {
  331. $descriptor->addField($cb(), true);
  332. }
  333. return $descriptor;
  334. }
  335. /**
  336. * Check if <person> has a value
  337. *
  338. * @return boolean
  339. */
  340. public function hasPerson(){
  341. return $this->_has(1);
  342. }
  343. /**
  344. * Clear <person> value
  345. *
  346. * @return \tests\AddressBook
  347. */
  348. public function clearPerson(){
  349. return $this->_clear(1);
  350. }
  351. /**
  352. * Get <person> value
  353. *
  354. * @param int $idx
  355. * @return \tests\Person
  356. */
  357. public function getPerson($idx = NULL){
  358. return $this->_get(1, $idx);
  359. }
  360. /**
  361. * Set <person> value
  362. *
  363. * @param \tests\Person $value
  364. * @return \tests\AddressBook
  365. */
  366. public function setPerson(\tests\Person $value, $idx = NULL){
  367. return $this->_set(1, $value, $idx);
  368. }
  369. /**
  370. * Get all elements of <person>
  371. *
  372. * @return \tests\Person[]
  373. */
  374. public function getPersonList(){
  375. return $this->_get(1);
  376. }
  377. /**
  378. * Add a new element to <person>
  379. *
  380. * @param \tests\Person $value
  381. * @return \tests\AddressBook
  382. */
  383. public function addPerson(\tests\Person $value){
  384. return $this->_add(1, $value);
  385. }
  386. }
  387. }