/**
* Adds a clone to the map.
*
* @param CodeClone $clone
*/
public function addClone(CodeClone $clone)
{
$id = $clone->getId();
if (!isset($this->clonesById[$id])) {
$this->clones[] = $clone;
$this->clonesById[$id] = $clone;
} else {
$existClone = $this->clonesById[$id];
foreach ($clone->getFiles() as $file) {
$existClone->addFile($file);
}
}
$this->numDuplicateLines += $clone->getSize();
}