Code Duplication    Length = 9-9 lines in 3 locations

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

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