--- a/lib/Protobuf-PHP/tests/protos/addressbook.php +++ b/lib/Protobuf-PHP/tests/protos/addressbook.php @@ -1,1 +1,460 @@ - +number = 1; + $f->name = "name"; + $f->type = 9; + $f->rule = 2; + $descriptor->addField($f); + + // required id = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "id"; + $f->type = 5; + $f->rule = 2; + $descriptor->addField($f); + + // optional email = 3 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 3; + $f->name = "email"; + $f->type = 9; + $f->rule = 1; + $descriptor->addField($f); + + // repeated .tests.Person.PhoneNumber phone = 4 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 4; + $f->name = "phone"; + $f->type = 11; + $f->rule = 3; + $f->reference = '\tests\Person\PhoneNumber'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } + + /** @var string */ + public $name = null; + + /** @var int */ + public $id = null; + + /** @var string */ + public $email = null; + + /** @var \tests\Person\PhoneNumber[] */ + public $phone = array(); + + + /** + * Check if has a value + * + * @return boolean + */ + public function hasName(){ + return $this->_has(1); + } + + /** + * Clear value + * + * @return \tests\Person + */ + public function clearName(){ + return $this->_clear(1); + } + + /** + * Get value + * + * @return string + */ + public function getName(){ + return $this->_get(1); + } + + /** + * Set value + * + * @param string $value + * @return \tests\Person + */ + public function setName( $value){ + return $this->_set(1, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasId(){ + return $this->_has(2); + } + + /** + * Clear value + * + * @return \tests\Person + */ + public function clearId(){ + return $this->_clear(2); + } + + /** + * Get value + * + * @return int + */ + public function getId(){ + return $this->_get(2); + } + + /** + * Set value + * + * @param int $value + * @return \tests\Person + */ + public function setId( $value){ + return $this->_set(2, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasEmail(){ + return $this->_has(3); + } + + /** + * Clear value + * + * @return \tests\Person + */ + public function clearEmail(){ + return $this->_clear(3); + } + + /** + * Get value + * + * @return string + */ + public function getEmail(){ + return $this->_get(3); + } + + /** + * Set value + * + * @param string $value + * @return \tests\Person + */ + public function setEmail( $value){ + return $this->_set(3, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasPhone(){ + return $this->_has(4); + } + + /** + * Clear value + * + * @return \tests\Person + */ + public function clearPhone(){ + return $this->_clear(4); + } + + /** + * Get value + * + * @param int $idx + * @return \tests\Person\PhoneNumber + */ + public function getPhone($idx = NULL){ + return $this->_get(4, $idx); + } + + /** + * Set 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 + * + * @return \tests\Person\PhoneNumber[] + */ + public function getPhoneList(){ + return $this->_get(4); + } + + /** + * Add a new element to + * + * @param \tests\Person\PhoneNumber $value + * @return \tests\Person + */ + public function addPhone(\tests\Person\PhoneNumber $value){ + return $this->_add(4, $value); + } + + } +} + +namespace tests\Person { + + class PhoneType { + const MOBILE = 0; + const HOME = 1; + const WORK = 2; + } +} + +namespace tests\Person { + + class PhoneNumber extends \DrSlump\Protobuf\Message { + + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + { + $descriptor = new \DrSlump\Protobuf\Descriptor('\tests\Person\PhoneNumber'); + + // required number = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "number"; + $f->type = 9; + $f->rule = 2; + $descriptor->addField($f); + + // optional .tests.Person.PhoneType type = 2 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 2; + $f->name = "type"; + $f->type = 14; + $f->rule = 1; + $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; + } + + /** @var string */ + public $number = null; + + /** @var int - \tests\Person\PhoneType */ + public $type = \tests\Person\PhoneType::HOME; + + + /** + * Check if has a value + * + * @return boolean + */ + public function hasNumber(){ + return $this->_has(1); + } + + /** + * Clear value + * + * @return \tests\Person\PhoneNumber + */ + public function clearNumber(){ + return $this->_clear(1); + } + + /** + * Get value + * + * @return string + */ + public function getNumber(){ + return $this->_get(1); + } + + /** + * Set value + * + * @param string $value + * @return \tests\Person\PhoneNumber + */ + public function setNumber( $value){ + return $this->_set(1, $value); + } + + /** + * Check if has a value + * + * @return boolean + */ + public function hasType(){ + return $this->_has(2); + } + + /** + * Clear value + * + * @return \tests\Person\PhoneNumber + */ + public function clearType(){ + return $this->_clear(2); + } + + /** + * Get value + * + * @return int - \tests\Person\PhoneType + */ + public function getType(){ + return $this->_get(2); + } + + /** + * Set value + * + * @param int - \tests\Person\PhoneType $value + * @return \tests\Person\PhoneNumber + */ + public function setType( $value){ + return $this->_set(2, $value); + } + + } +} + +namespace tests { + + class AddressBook extends \DrSlump\Protobuf\Message { + + /** @var \Closure[] */ + protected static $__extensions = array(); + + public static function descriptor(\DrSlump\Protobuf\Descriptor $descriptor = NULL) + { + $descriptor = new \DrSlump\Protobuf\Descriptor('\tests\AddressBook'); + + // repeated .tests.Person person = 1 + $f = new \DrSlump\Protobuf\Field(); + $f->number = 1; + $f->name = "person"; + $f->type = 11; + $f->rule = 3; + $f->reference = '\tests\Person'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } + + /** @var \tests\Person[] */ + public $person = array(); + + + /** + * Check if has a value + * + * @return boolean + */ + public function hasPerson(){ + return $this->_has(1); + } + + /** + * Clear value + * + * @return \tests\AddressBook + */ + public function clearPerson(){ + return $this->_clear(1); + } + + /** + * Get value + * + * @param int $idx + * @return \tests\Person + */ + public function getPerson($idx = NULL){ + return $this->_get(1, $idx); + } + + /** + * Set 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 + * + * @return \tests\Person[] + */ + public function getPersonList(){ + return $this->_get(1); + } + + /** + * Add a new element to + * + * @param \tests\Person $value + * @return \tests\AddressBook + */ + public function addPerson(\tests\Person $value){ + return $this->_add(1, $value); + } + + } +} +