protected function getProperties(&$object, $filter = 256 | 512 | 1024)
    {
        $properties = (new ReflectionClass($object))->getProperties($filter);

        //Removes properties added by PHPUnit, if the object is a mock
        $properties = $object instanceof MockObject ? array_filter($properties, function ($property) {
            return !string_starts_with($property->getName(), '__phpunit');
        }) : $properties;

        $values = array_map(function ($property) use ($object) {
            $property->setAccessible(true);

            return $property->getValue($object);
        }, $properties);

        return array_combine(objects_map($properties, 'getName'), $values);
    }