Code Duplication    Length = 8-9 lines in 2 locations

model/fieldtypes/DBField.php 1 location

@@ 268-275 (lines=8) @@
265
	/**
266
	 * Saves this field to the given data object.
267
	 */
268
	public function saveInto($dataObject) {
269
		$fieldName = $this->name;
270
		if($fieldName) {
271
			$dataObject->$fieldName = $this->value;
272
		} else {
273
			user_error("DBField::saveInto() Called on a nameless '" . get_class($this) . "' object", E_USER_ERROR);
274
		}
275
	}
276
277
	/**
278
	 * Returns a FormField instance used as a default

model/fieldtypes/Decimal.php 1 location

@@ 62-70 (lines=9) @@
59
	/**
60
	 * @param DataObject $dataObject
61
	 */
62
	public function saveInto($dataObject) {
63
		$fieldName = $this->name;
64
65
		if($fieldName) {
66
			$dataObject->$fieldName = (float)preg_replace('/[^0-9.\-\+]/', '', $this->value);
67
		} else {
68
			user_error("DBField::saveInto() Called on a nameless '" . get_class($this) . "' object", E_USER_ERROR);
69
		}
70
	}
71
72
	/**
73
	 * @param string $title