function readObject() { $data = ''; if ($this->ready()) { while (($c = $this->read()) != '') { $data .= $c; if ($data === 'obj[') { break; } } if ($data == 'obj[') { $count = ''; while (($c = $this->read()) != '') { if ($c === ']') { break; } $count .= $c; } settype($count, 'integer'); $c = $this->read(); if ($c === '[' && $count > 0) { $pos = 0; $data = ''; while (($c = $this->read()) != '' && $pos < $count) { $data .= $c; $pos++; } if ($c === ']' && strlen($data) === $count) { return ObjectSerializer::load($data); } } } } return NULL; }