+ /**
+ * Update the all links to the $old location to instead point to $new.
+ */
+ protected function updateLinks(DOMXPath $xpath, string $old, string $new)
+ {
+ $old = str_replace('"', '', $old);
+ $matchingLinks = $xpath->query('//body//*//*[@href="'.$old.'"]');
+ foreach ($matchingLinks as $domElem) {
+ $domElem->setAttribute('href', $new);
+ }
+ }
+