_status = self::NOT_STARTED; $this->key = $key; } /** * @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_VALUE; break; case Unserialize_Parser::TYPE_ARRAY: $this->_reader = new Unserialize_Reader_Arr(); $this->_status = self::READING_VALUE; break; case Unserialize_Parser::TYPE_INT: $this->_reader = new Unserialize_Reader_Int(); $this->_status = self::READING_VALUE; break; case Unserialize_Parser::TYPE_BOOL: $this->_reader = new Unserialize_Reader_Bool(); $this->_status = self::READING_VALUE; break; case Unserialize_Parser::TYPE_DOUBLE: $this->_reader = new Unserialize_Reader_Dbl(); $this->_status = self::READING_VALUE; break; default: throw new Exception('Unsupported data type ' . $char); } } if ($this->_status == self::READING_VALUE) { $value = $this->_reader->read($char, $prevChar); if (!is_null($value)) { return $value; } } return null; } }