private function dumpObject($value, $name): void
  {
    list($id, $ref) = $this->isReference($value);

    if ($ref===null)
    {
      $this->writer->writeObjectOpen($id, $name, get_class($value));

      // Dump all fields of the object, unless the object is me.
      if ($this!==$value)
      {
        $reflect    = new \ReflectionClass($value);
        $properties = $reflect->getProperties();

        if (strpos(get_class($value), '\\')!==false)
        {
          foreach ($properties as $property)
          {
            $propertyName = $property->getName();
            if ($property->isStatic())
            {
              $propertyValue = &self::getStaticProperty($value, $propertyName);
            }
            else
            {
              $propertyValue = &self::getProperty($value, $propertyName);
            }

            $this->recursiveDump($propertyValue, $propertyName);
          }
        }
        elseif (get_class($value)=='stdClass')
        {
          foreach ($value as $propertyName => $propertyValue)
          {
            $this->recursiveDump($propertyValue, $propertyName);
          }
        }
      }

      $this->writer->writeObjectClose($id, $name, get_class($value));
    }
    else
    {
      $this->writer->writeObjectReference($ref, $name, get_class($value));
    }
  }