function RepeatedField::__construct
Constructs an instance of RepeatedField.
@ignore
Parameters
integer $type Type of the stored element.:
string $klass Message/Enum class name (message/enum fields only).:
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ RepeatedField.php, line 52
Class
- RepeatedField
- RepeatedField is used by generated protocol message classes to manipulate repeated fields. It can be used like native PHP array.
Namespace
Google\Protobuf\InternalCode
public function __construct($type, $klass = null) {
$this->container = [];
$this->type = $type;
if ($this->type == GPBType::MESSAGE) {
$pool = DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByClassName($klass);
if ($desc == NULL) {
new $klass();
// No msg class instance has been created before.
$desc = $pool->getDescriptorByClassName($klass);
}
$this->klass = $desc->getClass();
$this->legacy_klass = $desc->getLegacyClass();
}
}