/**
  * @expectedException \Opensoft\SimpleSerializer\Exception\RecursionException
  */
 public function testInvolveException()
 {
     $stdClass = new \stdClass();
     $stdClass->recursion = null;
     ObjectHelper::involve($stdClass, new PropertyMetadata('recursion'), $stdClass);
 }
 /**
  * {@inheritDoc}
  *
  * @param mixed $data
  * @param object $object
  *
  * @return object
  */
 public function denormalize(array $data, $object)
 {
     $className = ObjectHelper::getFullClassName($object);
     $metadata = $this->metadataFactory->getMetadataForClass($className);
     $unserializedProperties = 0;
     foreach ($metadata->getProperties() as $property) {
         if ($this->propertySkipper->shouldSkip($property)) {
             if ($this->isMediumStrictUnserializeMode() && array_key_exists($property->getSerializedName(), $data)) {
                 throw new InvalidArgumentException(sprintf('%s extra field', $property->getSerializedName()));
             }
             continue;
         }
         if (!array_key_exists($property->getSerializedName(), $data)) {
             if ($this->isStrictUnserializeMode()) {
                 throw new InvalidArgumentException(sprintf('%s field is lost', $property->getSerializedName()));
             }
             continue;
         }
         $value = $this->dataProcessor->denormalizeProcess($this, $data[$property->getSerializedName()], $property, $object);
         ObjectHelper::involve($object, $property, $value);
         $unserializedProperties++;
     }
     if ($this->isMediumStrictUnserializeMode() && $unserializedProperties !== count($data)) {
         throw new InvalidArgumentException('Wrong number of fields in the deserialized data');
     }
     return $object;
 }