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

Method readJSONDouble

lib/php/lib/Protocol/TJSONProtocol.php:392–418  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

390 }
391
392 private function readJSONDouble()
393 {
394 $this->context_->read();
395
396 if (substr($this->reader_->peek(), 0, 1) == self::QUOTE) {
397 $arr = $this->readJSONString(true);
398
399 if ($arr == "NaN") {
400 return NAN;
401 } elseif ($arr == "Infinity") {
402 return INF;
403 } elseif (!$this->context_->escapeNum()) {
404 throw new TProtocolException(
405 "Numeric data unexpectedly quoted " . $arr,
406 TProtocolException::INVALID_DATA
407 );
408 }
409
410 return floatval($arr);
411 } else {
412 if ($this->context_->escapeNum()) {
413 $this->readJSONSyntaxChar(self::QUOTE);
414 }
415
416 return floatval($this->readJSONNumericChars());
417 }
418 }
419
420 private function readJSONObjectStart()
421 {

Callers 2

readDoubleMethod · 0.95
readDoubleMethod · 0.95

Calls 6

readJSONStringMethod · 0.95
readJSONSyntaxCharMethod · 0.95
readJSONNumericCharsMethod · 0.95
readMethod · 0.65
peekMethod · 0.45
escapeNumMethod · 0.45

Tested by

no test coverage detected