/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
- <?php
- // DO NOT EDIT! Generated by Protobuf-PHP protoc plugin @package_version@
- // Source: addressbook.proto
- // Date: 2011-10-04 14:32:12
- namespace tests\Person {
- class PhoneType extends \DrSlump\Protobuf\Enum {
- const MOBILE = 0;
- const HOME = 1;
- const WORK = 2;
- }
- }
- namespace tests\Person {
- class PhoneNumber extends \DrSlump\Protobuf\Message {
- /** @var string */
- public $number = null;
-
- /** @var int - \tests\Person\PhoneType */
- public $type = \tests\Person\PhoneType::HOME;
-
- /** @var \Closure[] */
- protected static $__extensions = array();
- public static function descriptor()
- {
- $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'tests.Person.PhoneNumber');
- // REQUIRED STRING number = 1
- $f = new \DrSlump\Protobuf\Field();
- $f->number = 1;
- $f->name = "number";
- $f->type = \DrSlump\Protobuf::TYPE_STRING;
- $f->rule = \DrSlump\Protobuf::RULE_REQUIRED;
- $descriptor->addField($f);
- // OPTIONAL ENUM type = 2
- $f = new \DrSlump\Protobuf\Field();
- $f->number = 2;
- $f->name = "type";
- $f->type = \DrSlump\Protobuf::TYPE_ENUM;
- $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
- $f->reference = '\tests\Person\PhoneType';
- $f->default = \tests\Person\PhoneType::HOME;
- $descriptor->addField($f);
- foreach (self::$__extensions as $cb) {
- $descriptor->addField($cb(), true);
- }
- return $descriptor;
- }
- /**
- * Check if <number> has a value
- *
- * @return boolean
- */
- public function hasNumber(){
- return $this->_has(1);
- }
-
- /**
- * Clear <number> value
- *
- * @return \tests\Person\PhoneNumber
- */
- public function clearNumber(){
- return $this->_clear(1);
- }
-
- /**
- * Get <number> value
- *
- * @return string
- */
- public function getNumber(){
- return $this->_get(1);
- }
-
- /**
- * Set <number> value
- *
- * @param string $value
- * @return \tests\Person\PhoneNumber
- */
- public function setNumber( $value){
- return $this->_set(1, $value);
- }
-
- /**
- * Check if <type> has a value
- *
- * @return boolean
- */
- public function hasType(){
- return $this->_has(2);
- }
-
- /**
- * Clear <type> value
- *
- * @return \tests\Person\PhoneNumber
- */
- public function clearType(){
- return $this->_clear(2);
- }
-
- /**
- * Get <type> value
- *
- * @return int - \tests\Person\PhoneType
- */
- public function getType(){
- return $this->_get(2);
- }
-
- /**
- * Set <type> value
- *
- * @param int - \tests\Person\PhoneType $value
- * @return \tests\Person\PhoneNumber
- */
- public function setType( $value){
- return $this->_set(2, $value);
- }
- }
- }
- namespace tests {
- class Person extends \DrSlump\Protobuf\Message {
- /** @var string */
- public $name = null;
-
- /** @var int */
- public $id = null;
-
- /** @var string */
- public $email = null;
-
- /** @var \tests\Person\PhoneNumber[] */
- public $phone = array();
-
- /** @var \Closure[] */
- protected static $__extensions = array();
- public static function descriptor()
- {
- $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'tests.Person');
- // REQUIRED STRING name = 1
- $f = new \DrSlump\Protobuf\Field();
- $f->number = 1;
- $f->name = "name";
- $f->type = \DrSlump\Protobuf::TYPE_STRING;
- $f->rule = \DrSlump\Protobuf::RULE_REQUIRED;
- $descriptor->addField($f);
- // REQUIRED INT32 id = 2
- $f = new \DrSlump\Protobuf\Field();
- $f->number = 2;
- $f->name = "id";
- $f->type = \DrSlump\Protobuf::TYPE_INT32;
- $f->rule = \DrSlump\Protobuf::RULE_REQUIRED;
- $descriptor->addField($f);
- // OPTIONAL STRING email = 3
- $f = new \DrSlump\Protobuf\Field();
- $f->number = 3;
- $f->name = "email";
- $f->type = \DrSlump\Protobuf::TYPE_STRING;
- $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
- $descriptor->addField($f);
- // REPEATED MESSAGE phone = 4
- $f = new \DrSlump\Protobuf\Field();
- $f->number = 4;
- $f->name = "phone";
- $f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
- $f->rule = \DrSlump\Protobuf::RULE_REPEATED;
- $f->reference = '\tests\Person\PhoneNumber';
- $descriptor->addField($f);
- foreach (self::$__extensions as $cb) {
- $descriptor->addField($cb(), true);
- }
- return $descriptor;
- }
- /**
- * Check if <name> has a value
- *
- * @return boolean
- */
- public function hasName(){
- return $this->_has(1);
- }
-
- /**
- * Clear <name> value
- *
- * @return \tests\Person
- */
- public function clearName(){
- return $this->_clear(1);
- }
-
- /**
- * Get <name> value
- *
- * @return string
- */
- public function getName(){
- return $this->_get(1);
- }
-
- /**
- * Set <name> value
- *
- * @param string $value
- * @return \tests\Person
- */
- public function setName( $value){
- return $this->_set(1, $value);
- }
-
- /**
- * Check if <id> has a value
- *
- * @return boolean
- */
- public function hasId(){
- return $this->_has(2);
- }
-
- /**
- * Clear <id> value
- *
- * @return \tests\Person
- */
- public function clearId(){
- return $this->_clear(2);
- }
-
- /**
- * Get <id> value
- *
- * @return int
- */
- public function getId(){
- return $this->_get(2);
- }
-
- /**
- * Set <id> value
- *
- * @param int $value
- * @return \tests\Person
- */
- public function setId( $value){
- return $this->_set(2, $value);
- }
-
- /**
- * Check if <email> has a value
- *
- * @return boolean
- */
- public function hasEmail(){
- return $this->_has(3);
- }
-
- /**
- * Clear <email> value
- *
- * @return \tests\Person
- */
- public function clearEmail(){
- return $this->_clear(3);
- }
-
- /**
- * Get <email> value
- *
- * @return string
- */
- public function getEmail(){
- return $this->_get(3);
- }
-
- /**
- * Set <email> value
- *
- * @param string $value
- * @return \tests\Person
- */
- public function setEmail( $value){
- return $this->_set(3, $value);
- }
-
- /**
- * Check if <phone> has a value
- *
- * @return boolean
- */
- public function hasPhone(){
- return $this->_has(4);
- }
-
- /**
- * Clear <phone> value
- *
- * @return \tests\Person
- */
- public function clearPhone(){
- return $this->_clear(4);
- }
-
- /**
- * Get <phone> value
- *
- * @param int $idx
- * @return \tests\Person\PhoneNumber
- */
- public function getPhone($idx = NULL){
- return $this->_get(4, $idx);
- }
-
- /**
- * Set <phone> value
- *
- * @param \tests\Person\PhoneNumber $value
- * @return \tests\Person
- */
- public function setPhone(\tests\Person\PhoneNumber $value, $idx = NULL){
- return $this->_set(4, $value, $idx);
- }
-
- /**
- * Get all elements of <phone>
- *
- * @return \tests\Person\PhoneNumber[]
- */
- public function getPhoneList(){
- return $this->_get(4);
- }
-
- /**
- * Add a new element to <phone>
- *
- * @param \tests\Person\PhoneNumber $value
- * @return \tests\Person
- */
- public function addPhone(\tests\Person\PhoneNumber $value){
- return $this->_add(4, $value);
- }
- }
- }
- namespace tests {
- class AddressBook extends \DrSlump\Protobuf\Message {
- /** @var \tests\Person[] */
- public $person = array();
-
- /** @var \Closure[] */
- protected static $__extensions = array();
- public static function descriptor()
- {
- $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'tests.AddressBook');
- // REPEATED MESSAGE person = 1
- $f = new \DrSlump\Protobuf\Field();
- $f->number = 1;
- $f->name = "person";
- $f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
- $f->rule = \DrSlump\Protobuf::RULE_REPEATED;
- $f->reference = '\tests\Person';
- $descriptor->addField($f);
- foreach (self::$__extensions as $cb) {
- $descriptor->addField($cb(), true);
- }
- return $descriptor;
- }
- /**
- * Check if <person> has a value
- *
- * @return boolean
- */
- public function hasPerson(){
- return $this->_has(1);
- }
-
- /**
- * Clear <person> value
- *
- * @return \tests\AddressBook
- */
- public function clearPerson(){
- return $this->_clear(1);
- }
-
- /**
- * Get <person> value
- *
- * @param int $idx
- * @return \tests\Person
- */
- public function getPerson($idx = NULL){
- return $this->_get(1, $idx);
- }
-
- /**
- * Set <person> value
- *
- * @param \tests\Person $value
- * @return \tests\AddressBook
- */
- public function setPerson(\tests\Person $value, $idx = NULL){
- return $this->_set(1, $value, $idx);
- }
-
- /**
- * Get all elements of <person>
- *
- * @return \tests\Person[]
- */
- public function getPersonList(){
- return $this->_get(1);
- }
-
- /**
- * Add a new element to <person>
- *
- * @param \tests\Person $value
- * @return \tests\AddressBook
- */
- public function addPerson(\tests\Person $value){
- return $this->_add(1, $value);
- }
- }
- }