HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/globfdxw/www/wp-content/plugins/give/src/FormMigration/Actions/TransferFormUrl.php
<?php

namespace Give\FormMigration\Actions;

class TransferFormUrl
{
    protected $sourceId;

    public function __construct($sourceId)
    {
        $this->sourceId = $sourceId;
    }

    public static function from($sourceId): self
    {
        return new TransferFormUrl($sourceId);
    }

    public function to($destinationId): void
    {
        $this->__invoke($destinationId);
    }

    public function __invoke($destinationId)
    {
        $postName = get_post($this->sourceId)->post_name;
        wp_update_post(['ID' => $this->sourceId, 'post_name' => $postName . '-v2']);
        wp_update_post(['ID' => $destinationId, 'post_name' => $postName]);
    }
}