Code Duplication    Length = 9-9 lines in 3 locations

src/SilverStripe/BehatExtension/Context/FixtureContext.php 3 locations

@@ 152-160 (lines=9) @@
149
            array($field => $value)
150
        );
151
        // We should check if this fixture object already exists - if it does, we update it. If not, we create it
152
        if ($existingFixture = $this->fixtureFactory->get($class, $id)) {
153
            // Merge existing data with new data, and create new object to replace existing object
154
            foreach ($fields as $k => $v) {
155
                $existingFixture->$k = $v;
156
            }
157
            $existingFixture->write();
158
        } else {
159
            $this->fixtureFactory->createObject($class, $id, $fields);
160
        }
161
    }
162
163
    /**
@@ 183-191 (lines=9) @@
180
        );
181
        $fields = $this->prepareFixture($class, $id, $fields);
182
        // We should check if this fixture object already exists - if it does, we update it. If not, we create it
183
        if ($existingFixture = $this->fixtureFactory->get($class, $id)) {
184
            // Merge existing data with new data, and create new object to replace existing object
185
            foreach ($fields as $k => $v) {
186
                $existingFixture->$k = $v;
187
            }
188
            $existingFixture->write();
189
        } else {
190
            $this->fixtureFactory->createObject($class, $id, $fields);
191
        }
192
    }
193
194
    /**
@@ 210-218 (lines=9) @@
207
        $fields = $this->prepareFixture($class, $id, $fields);
208
209
        // We should check if this fixture object already exists - if it does, we update it. If not, we create it
210
        if ($existingFixture = $this->fixtureFactory->get($class, $id)) {
211
            // Merge existing data with new data, and create new object to replace existing object
212
            foreach ($fields as $k => $v) {
213
                $existingFixture->$k = $v;
214
            }
215
            $existingFixture->write();
216
        } else {
217
            $this->fixtureFactory->createObject($class, $id, $fields);
218
        }
219
    }
220
221
    /**