Code Duplication    Length = 3-3 lines in 2 locations

DataSource/Iterator.php 2 locations

@@ 42-44 (lines=3) @@
39
        foreach ($this->propertyPaths as $i => $propertyPath) {
40
            try {
41
                if (($property = $this->propertyAccessor->getValue($this->iterator->current()[0], $propertyPath)) instanceof PersistentCollection) {
42
                    if (!(isset($data[(string) $propertyPath]) && is_array($data[(string) $propertyPath]))) {
43
                        $data[(string) $propertyPath] = [];
44
                    }
45
46
                    foreach ($property as $subEntity) {
47
                        $data[(string) $propertyPath][] = (string) $subEntity;
@@ 57-59 (lines=3) @@
54
                $subProperty = preg_replace('/^.+\./U', '', $propertyPath);
55
                if ($collection != (string) $propertyPath && $subProperty) {
56
                    if (($property = $this->propertyAccessor->getValue($this->iterator->current()[0], $collection)) instanceof PersistentCollection) {
57
                        if (!(isset($data[$collection]) && is_array($data[$collection]))) {
58
                            $data[$collection] = [];
59
                        }
60
61
                        foreach ($property as $subEntity) {
62
                            $data[$collection][spl_object_hash($subEntity)][$subProperty] = (string) $this->propertyAccessor->getValue($subEntity, $subProperty);