@param \ReflectionObject $refObject

@return ReflectionProperty[]
340800
protected function getAllProperties(\ReflectionObject $refObject)
    {
        return $refObject->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED | ReflectionProperty::IS_STATIC);
    }
537127
protected function getClassMethods(\ReflectionClass $refClass)
    {
        $methods = [];
        foreach ($refClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
            $methods[$method->name] = $method;
        }

        return $methods;
    }
1149677
private function extractObjectProperties($object)
    {
        $propertyToValue = [];

        if (method_exists($object, '__sleep')) {
            $properties = $object->__sleep();
            foreach ($properties as $property) {
                $propertyToValue[$property] = $object->$property;
            }

            return $propertyToValue;
        }


        $reflectedProperties = [];
        $ref = new \ReflectionClass($object);
        foreach ($ref->getProperties() as $property) {
            $property->setAccessible(true);
            $propertyToValue[$property->getName()] = $property->getValue($object);
            $reflectedProperties[] = $property->getName();
        }

        $dynamicProperties = array_diff(array_keys(get_object_vars($object)), $reflectedProperties);

        foreach ($dynamicProperties as $property) {
            $propertyToValue[$property] = $object->$property;
        }

        return $propertyToValue;
    }
260183
public function serialize($object)
    {
        if (!$this->canHandle(get_class($object))) {
            throw new \InvalidArgumentException();
        }

        return [ $object->getTimestamp(), $object->getTimezone() ];
    }
52821
public static function getSafeCollectionProperty(\stdClass $object, ...$properties)
    {
        $property = self::getSafeProperty($object, ...$properties);
        if ($property === null || !is_array($property)) {
            return [];
        }
        return $property;
    }
548173
public function serialize($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('Argument must be an object');
        }

        $reflectedObject = new \ReflectionObject($object);
        $reflectedProperties = $reflectedObject->getProperties();

        $array = array();

        foreach ($reflectedProperties as $property) {
            $value = $this->getValue($object, $property);

            if (null !== $value) {
                if (!is_scalar($value)) {
                    $value = $this->normalize($value);
                }

                $array[$this->formatter->toMongoKey($property->getName())] = $value;
            }
        }

        return $array;
    }
744079
private static function getProperties($class): array
    {
        $reflect = new \ReflectionClass($class);
        $prop = $reflect->getProperties(
            \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED | \ReflectionProperty::IS_PRIVATE
        );
        $properties = [];
        foreach ($prop as $property) {
            $properties[] = $property->name;
        }
        $parent = \get_parent_class($class);
        if ($parent) {
            $properties = \array_merge(self::getProperties($parent), $properties);
        }
        return $properties;
    }
851976
public function retrieveValue(\ReflectionProperty $refProperty)
    {
        $propName = $refProperty->getName();

        if (array_key_exists("\0*\0" . $propName, $this->objectArray)) {
            // Protected or a private
            return $this->objectArray["\0*\0" . $propName];
        }

        if (array_key_exists($propName, $this->objectArray)) {
            // Must be a public. Those are rare.
            return $this->objectArray[$propName];
        }

        if ($refProperty->isStatic() === true) {
            // Static values are not inside the value array.
            $refProperty->setAccessible(true);
            return $refProperty->getValue($this->data);
        }

        // If we are facing multiple declarations, the declaring class name
        // is set in front of the key.
        $propName = "\0" . $refProperty->getDeclaringClass()->getName() . "\0" . $propName;
        if (array_key_exists($propName, $this->objectArray)) {
            // Found it!
            return $this->objectArray[$propName];
        }

        // We are still here, which means that we are not able to get the value
        // out of it. The only remaining possibility is, that this value was
        // unset during runtime.
        $refProperty->isUnset = true;
        return null;
    }
322306
protected function _toArray($object)
    {
        $reflectionClass = new \ReflectionClass(get_class($object));
        $array           = array();
        foreach ($reflectionClass->getProperties() as $property)
        {
            $property->setAccessible(true);
            $array[$property->getName()] = $property->getValue($object);
            $property->setAccessible(false);
        }
        return $array;
    }
321929
public function getPropForkObject(object $object): object {
		return $this->getObjectPropertyAccessProxy()->getValue($object) 
				?? ReflectionUtils::createObject($this->getEntityProperty(true)
						->getEmbeddedEntityPropertyCollection()->getClass());
	}
243293
private function extractProperties(
        object $object,
        MapInterface $properties
    ): MapInterface {
        $refl = $this->reflection($object);

        return $properties->reduce(
            new Map('string', 'mixed'),
            static function(MapInterface $carry, string $name, Property $property) use ($refl): MapInterface {
                return $carry->put(
                    $name,
                    $property
                        ->type()
                        ->forDatabase(
                            $refl->extract($name)->get($name)
                        )
                );
            }
        );
    }
1113439
private function getClassInfo($defClass) {
		if (is_object($defClass)) {
			if ($defClass instanceof ReflectionClass) {
				$className = $defClass->getName();
				$refClass = $defClass;
			} else {
				$className = get_class($defClass);
				$refClass = new ReflectionClass($className);
			}
		} else {
			$className = $defClass;
			$refClass = new ReflectionClass($className);
		}

		return [ $className, $refClass ];
	}
222252
private function getParentProperties(\ReflectionClass $reflectionClass)
    {
        $parent = $reflectionClass->getParentClass();
        if ($parent != null) {
            return array_merge($reflectionClass->getProperties(), $this->getParentProperties($parent));
        }

        return $reflectionClass->getProperties();
    }
97499
protected function normalizeAsAttributes($object) : array
    {
        if (is_null($object)) {
            return $this->nullObjectAttributes();
        }

        $attributesMap = $this->getAttributesDictionnary();

        $wrapper = $this->factory->make($object);

        $normalizedAttributes = [];

        foreach ($attributesMap as $embedKey => $parentKey) {
            $normalizedAttributes[$parentKey] = $wrapper->getEntityAttribute($embedKey);
        }

        return $normalizedAttributes;
    }
1107428
protected function extractObjectProperties($object): array
    {
        $properties = [];

        $reflection = new \ReflectionObject($object);

        // obtain public, protected and private properties of the class itself:

        foreach ($reflection->getProperties() as $property) {
            if ($property->isStatic()) {
                continue; // omit static properties
            }

            $property->setAccessible(true);

            $properties["\${$property->name}"] = $property->getValue($object);
        }

        // obtain any inherited private properties from parent classes:

        while ($reflection = $reflection->getParentClass()) {
            foreach ($reflection->getProperties(\ReflectionProperty::IS_PRIVATE) as $property) {
                $property->setAccessible(true);

                $properties["{$reflection->name}::\${$property->name}"] = $property->getValue($object);
            }
        }

        return $properties;
    }
41406
public function persistObject($object) : array
    {
        $data = $this->preparePersistChangeSet($object);

        $class = $this->getClassMetadata();

        if (! isset($data[$class->getIdentifier()[0]])) {
            $data[$class->getIdentifier()[0]] = $this->generateNextId($class);
        }

        $this->objects[$data[$class->getIdentifier()[0]]] = $data;

        return $data;
    }
1023257
protected function getObjectProperties(array $objects): array
    {
        $objectProperties = [];
        /** @var ITypedObject[] $objects */
        foreach ($objects as $key => $object) {
            $objectProperties[$key] = $object->toArray();
        }

        return $objectProperties;
    }