Reader::readObjectWithoutTag PHP Method

readObjectWithoutTag() public method

    public function readObjectWithoutTag()
    {
        $index = (int) $this->stream->readuntil(Tags::TagOpenbrace);
        list($classname, $props) = $this->classref[$index];
        if ($classname == 'stdClass') {
            $object = new stdClass();
            $this->refer->set($object);
            foreach ($props as $prop) {
                $object->{$prop} = $this->unserialize();
            }
        } else {
            $reflector = new ReflectionClass($classname);
            if ($reflector->getConstructor() === null) {
                if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
                    $object = $reflector->newInstanceWithoutConstructor();
                } else {
                    $object = new $classname();
                }
            } else {
                $object = $reflector->newInstance();
            }
            $this->refer->set($object);
            foreach ($props as $prop) {
                $value = $this->unserialize();
                if ($reflector->hasProperty($prop)) {
                    $property = $reflector->getProperty($prop);
                    $property->setAccessible(true);
                    $property->setValue($object, $value);
                } else {
                    $p = strtoupper($prop[0]) . substr($prop, 1);
                    if ($reflector->hasProperty($p)) {
                        $property = $reflector->getProperty($p);
                        $property->setAccessible(true);
                        $property->setValue($object, $value);
                    } else {
                        $object->{$prop} = $value;
                    }
                }
            }
        }
        $this->stream->skip(1);
        return $object;
    }