/** * Merges the data from another instance. * * @param CodeCoverage $that */ public function merge(CodeCoverage $that) { $this->filter->setWhitelistedFiles(array_merge($this->filter->getWhitelistedFiles(), $that->filter()->getWhitelistedFiles())); foreach ($that->data as $file => $lines) { if (!isset($this->data[$file])) { if (!$this->filter->isFiltered($file)) { $this->data[$file] = $lines; } continue; } foreach ($lines as $line => $data) { if ($data !== null) { if (!isset($this->data[$file][$line])) { $this->data[$file][$line] = $data; } else { $this->data[$file][$line] = array_unique(array_merge($this->data[$file][$line], $data)); } } } } $this->tests = array_merge($this->tests, $that->getTests()); }