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

Method _readList

lib/php/lib/Exception/TException.php:138–191  ·  view source on GitHub ↗
(&$var, $spec, $input, $set = false)

Source from the content-addressed store, hash-verified

136 }
137
138 private function _readList(&$var, $spec, $input, $set = false)
139 {
140 $xfer = 0;
141 $etype = $spec['etype'];
142 $eread = $vread = null;
143 if (isset(TBase::$tmethod[$etype])) {
144 $eread = 'read' . TBase::$tmethod[$etype];
145 } else {
146 $espec = $spec['elem'];
147 }
148 $var = array();
149 $_etype = $size = 0;
150 if ($set) {
151 $xfer += $input->readSetBegin($_etype, $size);
152 } else {
153 $xfer += $input->readListBegin($_etype, $size);
154 }
155 for ($i = 0; $i < $size; ++$i) {
156 $elem = null;
157 if ($eread !== null) {
158 $xfer += $input->$eread($elem);
159 } else {
160 $espec = $spec['elem'];
161 switch ($etype) {
162 case TType::STRUCT:
163 $class = $espec['class'];
164 $elem = new $class();
165 $xfer += $elem->read($input);
166 break;
167 case TType::MAP:
168 $xfer += $this->_readMap($elem, $espec, $input);
169 break;
170 case TType::LST:
171 $xfer += $this->_readList($elem, $espec, $input, false);
172 break;
173 case TType::SET:
174 $xfer += $this->_readList($elem, $espec, $input, true);
175 break;
176 }
177 }
178 if ($set) {
179 $var[$elem] = true;
180 } else {
181 $var [] = $elem;
182 }
183 }
184 if ($set) {
185 $xfer += $input->readSetEnd();
186 } else {
187 $xfer += $input->readListEnd();
188 }
189
190 return $xfer;
191 }
192
193 protected function _read($class, $spec, $input)
194 {

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