Code Duplication    Length = 9-9 lines in 3 locations

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

@@ 137-145 (lines=9) @@
134
			array($field => $value)
135
		);
136
		// We should check if this fixture object already exists - if it does, we update it. If not, we create it
137
		if($existingFixture = $this->fixtureFactory->get($class, $id)) {
138
			// Merge existing data with new data, and create new object to replace existing object
139
			foreach($fields as $k => $v) {
140
				$existingFixture->$k = $v;
141
			}
142
			$existingFixture->write();
143
		} else {
144
			$this->fixtureFactory->createObject($class, $id, $fields);
145
		}
146
	}
147
   
148
	/**
@@ 167-175 (lines=9) @@
164
		);
165
		$fields = $this->prepareFixture($class, $id, $fields);
166
		// We should check if this fixture object already exists - if it does, we update it. If not, we create it
167
		if($existingFixture = $this->fixtureFactory->get($class, $id)) {
168
			// Merge existing data with new data, and create new object to replace existing object
169
			foreach($fields as $k => $v) {
170
				$existingFixture->$k = $v;
171
			}
172
			$existingFixture->write();
173
		} else {
174
			$this->fixtureFactory->createObject($class, $id, $fields);
175
		}
176
	}
177
178
	/**
@@ 193-201 (lines=9) @@
190
		$fields = $this->prepareFixture($class, $id, $fields);
191
192
		// We should check if this fixture object already exists - if it does, we update it. If not, we create it
193
		if($existingFixture = $this->fixtureFactory->get($class, $id)) {
194
			// Merge existing data with new data, and create new object to replace existing object
195
			foreach($fields as $k => $v) {
196
				$existingFixture->$k = $v;
197
			}
198
			$existingFixture->write();
199
		} else {
200
			$this->fixtureFactory->createObject($class, $id, $fields);
201
		}
202
	}
203
204
	/**