mappingStrategyFactory->getStrategy($isRepost); return $this->fixLinks($strategy->map($item)); } private function fixLinks(VkPost $vkPost): VkPost { $text = $vkPost->getText(); if (empty($text)) return $vkPost; $newText = preg_replace_callback("#\[([^|]+)\|([^\]]+)\]#u", function ($matches) { $alias = $matches[1]; // то, что после vk.com/ $label = $matches[2]; // текст ссылки return "{$label}"; }, $text); $vkPost->setText($newText); return $vkPost; } }