public static function replaceSlugInPath($path, $id, $slug) { return preg_replace('#(.+/)?.*(-' . $id . '/)#', '$1' . $slug . '$2', $path); }