_status = self::NOT_STARTED; } /** * @param string $char * @param string $prevChar * @return mixed|null * @throws Exception */ public function read($char, $prevChar) { if ($this->_status == self::NOT_STARTED) { switch ($char) { case Unserialize_Parser::TYPE_STRING: $this->_reader = new Unserialize_Reader_Str(); $this->_status = self::READING_KEY; break; case Unserialize_Parser::TYPE_INT: $this->_reader = new Unserialize_Reader_Int(); $this->_status = self::READING_KEY; break; default: throw new Exception('Unsupported data type ' . $char); } } if ($this->_status == self::READING_KEY) { $key = $this->_reader->read($char, $prevChar); if (!is_null($key)) { return $key; } } return null; } }