Пример #1
0
 /**
  * @param mixed $data
  */
 public function __construct($data = null)
 {
     // Cache the descriptor instance for this class
     if (!static::$__descriptor) {
         static::$__descriptor = Protobuf::getRegistry()->getDescriptor($this);
     }
     // Alias the descriptor to this object instance since it's faster to access
     $this->_descriptor = static::$__descriptor;
     // BACKWARDS COMPATIBILITY: Unset public properties
     $publicfields = get_object_vars($this);
     foreach ($this->_descriptor->getFields() as $field) {
         $name = $field->name;
         if (array_key_exists($name, $publicfields)) {
             //trigger_error('DESTROYING PUBLIC FIELD: '  . $name);
             unset($this->{$name});
         }
     }
     if (NULL !== $data) {
         $this->parse($data);
     }
 }