| 1 |
<?php |
| 2 |
|
| 3 |
namespace IvyForms\Common\Helpers\Import; |
| 4 |
|
| 5 |
// phpcs:disable PSR1.Files.SideEffects |
| 6 |
|
| 7 |
if (!defined('ABSPATH')) { |
| 8 |
exit; |
| 9 |
} |
| 10 |
|
| 11 |
/** |
| 12 |
* Contract for a form import source (IvyForms native or third-party builder). |
| 13 |
* |
| 14 |
* Each source owns its own detection and normalization so new builders can |
| 15 |
* register without extending a shared switch. |
| 16 |
*/ |
| 17 |
interface FormImportSourceInterface |
| 18 |
{ |
| 19 |
/** |
| 20 |
* Stable source identifier (e.g. ivyforms, wsform, fluentforms). |
| 21 |
* |
| 22 |
* @return string |
| 23 |
*/ |
| 24 |
public function getId(): string; |
| 25 |
|
| 26 |
/** |
| 27 |
* Whether this source can handle the decoded import payload. |
| 28 |
* |
| 29 |
* @param array<string|int, mixed> $importData |
| 30 |
* @return bool |
| 31 |
*/ |
| 32 |
public function matches(array $importData): bool; |
| 33 |
|
| 34 |
/** |
| 35 |
* Convert the payload into the IvyForms import structure |
| 36 |
* (`['forms' => [...]]`). |
| 37 |
* |
| 38 |
* @param array<string|int, mixed> $importData |
| 39 |
* @return array<string, mixed> |
| 40 |
*/ |
| 41 |
public function normalize(array $importData): array; |
| 42 |
} |
| 43 |
|