MCPcopy Create free account
hub / github.com/apache/thrift / _readList

Method _readList

lib/php/src/Thrift.php:166–219  ·  view source on GitHub ↗
(&$var, $spec, $input, $set=false)

Source from the content-addressed store, hash-verified

164 }
165
166 private function _readList(&$var, $spec, $input, $set=false)
167 {
168 $xfer = 0;
169 $etype = $spec['etype'];
170 $eread = $vread = null;
171 if (isset(TBase::$tmethod[$etype])) {
172 $eread = 'read'.TBase::$tmethod[$etype];
173 } else {
174 $espec = $spec['elem'];
175 }
176 $var = array();
177 $_etype = $size = 0;
178 if ($set) {
179 $xfer += $input->readSetBegin($_etype, $size);
180 } else {
181 $xfer += $input->readListBegin($_etype, $size);
182 }
183 for ($i = 0; $i < $size; ++$i) {
184 $elem = null;
185 if ($eread !== null) {
186 $xfer += $input->$eread($elem);
187 } else {
188 $espec = $spec['elem'];
189 switch ($etype) {
190 case TType::STRUCT:
191 $class = $espec['class'];
192 $elem = new $class();
193 $xfer += $elem->read($input);
194 break;
195 case TType::MAP:
196 $xfer += $this->_readMap($elem, $espec, $input);
197 break;
198 case TType::LST:
199 $xfer += $this->_readList($elem, $espec, $input, false);
200 break;
201 case TType::SET:
202 $xfer += $this->_readList($elem, $espec, $input, true);
203 break;
204 }
205 }
206 if ($set) {
207 $var[$elem] = true;
208 } else {
209 $var []= $elem;
210 }
211 }
212 if ($set) {
213 $xfer += $input->readSetEnd();
214 } else {
215 $xfer += $input->readListEnd();
216 }
217
218 return $xfer;
219 }
220
221 protected function _read($class, $spec, $input)
222 {

Callers 2

_readMapMethod · 0.95
_readMethod · 0.95

Calls 6

_readMapMethod · 0.95
readSetBeginMethod · 0.65
readListBeginMethod · 0.65
readMethod · 0.65
readSetEndMethod · 0.65
readListEndMethod · 0.65

Tested by

no test coverage detected