Code Duplication    Length = 8-10 lines in 2 locations

engine/classes/Elgg/Database/MetadataTable.php 2 locations

@@ 170-177 (lines=8) @@
167
	
168
			if ($id !== false) {
169
				$obj = $this->get($id);
170
				if ($this->events->trigger('create', 'metadata', $obj)) {
171
172
					$this->cache->clear($entity_guid);
173
	
174
					return $id;
175
				} else {
176
					$this->delete($id);
177
				}
178
			}
179
		}
180
	
@@ 247-256 (lines=10) @@
244
			. " owner_guid=$owner_guid where id=$id";
245
	
246
		$result = $this->db->updateData($query);
247
		if ($result !== false) {
248
	
249
			$this->cache->clear($md->entity_guid);
250
	
251
			// @todo this event tells you the metadata has been updated, but does not
252
			// let you do anything about it. What is needed is a plugin hook before
253
			// the update that passes old and new values.
254
			$obj = $this->get($id);
255
			$this->events->trigger('update', 'metadata', $obj);
256
		}
257
	
258
		return $result;
259
	}