Reader::unserialize PHP Method

unserialize() public method

public unserialize ( )
    public function unserialize()
    {
        $tag = $this->stream->getc();
        switch ($tag) {
            case '0':
                return 0;
            case '1':
                return 1;
            case '2':
                return 2;
            case '3':
                return 3;
            case '4':
                return 4;
            case '5':
                return 5;
            case '6':
                return 6;
            case '7':
                return 7;
            case '8':
                return 8;
            case '9':
                return 9;
            case Tags::TagInteger:
                return $this->readIntegerWithoutTag();
            case Tags::TagLong:
                return $this->readLongWithoutTag();
            case Tags::TagDouble:
                return $this->readDoubleWithoutTag();
            case Tags::TagNull:
                return null;
            case Tags::TagEmpty:
                return '';
            case Tags::TagTrue:
                return true;
            case Tags::TagFalse:
                return false;
            case Tags::TagNaN:
                return log(-1);
            case Tags::TagInfinity:
                return $this->readInfinityWithoutTag();
            case Tags::TagDate:
                return $this->readDateWithoutTag();
            case Tags::TagTime:
                return $this->readTimeWithoutTag();
            case Tags::TagBytes:
                return $this->readBytesWithoutTag();
            case Tags::TagUTF8Char:
                return $this->readUTF8CharWithoutTag();
            case Tags::TagString:
                return $this->readStringWithoutTag();
            case Tags::TagGuid:
                return $this->readGuidWithoutTag();
            case Tags::TagList:
                return $this->readListWithoutTag();
            case Tags::TagMap:
                return $this->readMapWithoutTag();
            case Tags::TagClass:
                $this->readClass();
                return $this->readObject();
            case Tags::TagObject:
                return $this->readObjectWithoutTag();
            case Tags::TagRef:
                return $this->readRef();
            case Tags::TagError:
                throw new Exception($this->privateReadString());
            default:
                throw $this->unexpectedTag($tag);
        }
    }

Usage Example

Exemplo n.º 1
0
 public static function unserialize($data, $simple = false)
 {
     $stream = new BytesIO($data);
     $reader = new Reader($stream, $simple);
     $result = $reader->unserialize();
     $stream->close();
     return $result;
 }
All Usage Examples Of Reader::unserialize