/** * @return string */ public function mutate() { $running_delta = 0; foreach ($this->selector->getSelection() as $range) { //if anything has adjusted the delta $range->setOffset($running_delta); //after correcting the offset, it's safe to split it $temp = $range->parts($this->selector->getSource()); //once we split it we have the middle string and can calculate the new delta $running_delta += $this->subDelta($temp['mid']); $temp['mid'] = $this->subMutate($temp['mid']); $this->selector->setSource(implode('', $temp)); } return $this->selector->getSource(); }