Code Duplication    Length = 18-18 lines in 2 locations

src/LIN3S/SharedKernel/Event/StoredEvent.php 2 locations

@@ 107-124 (lines=18) @@
104
        }
105
    }
106
107
    private function serializePayload(\ReflectionProperty $property, $object, array $result = [])
108
    {
109
        $property->setAccessible(true);
110
        $value = $property->getValue($object);
111
        if (is_scalar($value)) {
112
            return $value;
113
        }
114
115
        $className = get_class($value);
116
        $reflectionClass = new \ReflectionClass($value);
117
        $properties = $reflectionClass->getProperties();
118
119
        foreach ($properties as $property) {
120
            $result[$className][$property->getName()] = $this->serializePayload($property, $value);
121
        }
122
123
        return $result;
124
    }
125
126
    private function serializeEvent(\ReflectionProperty $property, $object, array $result = [])
127
    {
@@ 126-143 (lines=18) @@
123
        return $result;
124
    }
125
126
    private function serializeEvent(\ReflectionProperty $property, $object, array $result = [])
127
    {
128
        $property->setAccessible(true);
129
        $value = $property->getValue($object);
130
        if (is_scalar($value)) {
131
            return $value;
132
        }
133
134
        $className = get_class($value);
135
        $reflectionClass = new \ReflectionClass($value);
136
        $properties = $reflectionClass->getProperties();
137
138
        foreach ($properties as $property) {
139
            $result = $this->serializeEvent($property, $value, $result);
140
        }
141
142
        return $result;
143
    }
144
145
    private function formatType() : string
146
    {