Code Duplication    Length = 9-9 lines in 3 locations

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

@@ 143-151 (lines=9) @@
140
			array($field => $value)
141
		);
142
		// We should check if this fixture object already exists - if it does, we update it. If not, we create it
143
		if($existingFixture = $this->fixtureFactory->get($class, $id)) {
144
			// Merge existing data with new data, and create new object to replace existing object
145
			foreach($fields as $k => $v) {
146
				$existingFixture->$k = $v;
147
			}
148
			$existingFixture->write();
149
		} else {
150
			$this->fixtureFactory->createObject($class, $id, $fields);
151
		}
152
	}
153
154
	/**
@@ 173-181 (lines=9) @@
170
		);
171
		$fields = $this->prepareFixture($class, $id, $fields);
172
		// We should check if this fixture object already exists - if it does, we update it. If not, we create it
173
		if($existingFixture = $this->fixtureFactory->get($class, $id)) {
174
			// Merge existing data with new data, and create new object to replace existing object
175
			foreach($fields as $k => $v) {
176
				$existingFixture->$k = $v;
177
			}
178
			$existingFixture->write();
179
		} else {
180
			$this->fixtureFactory->createObject($class, $id, $fields);
181
		}
182
	}
183
184
	/**
@@ 199-207 (lines=9) @@
196
		$fields = $this->prepareFixture($class, $id, $fields);
197
198
		// We should check if this fixture object already exists - if it does, we update it. If not, we create it
199
		if($existingFixture = $this->fixtureFactory->get($class, $id)) {
200
			// Merge existing data with new data, and create new object to replace existing object
201
			foreach($fields as $k => $v) {
202
				$existingFixture->$k = $v;
203
			}
204
			$existingFixture->write();
205
		} else {
206
			$this->fixtureFactory->createObject($class, $id, $fields);
207
		}
208
	}
209
210
	/**