| 1 |
<?php |
| 2 |
/** |
| 3 |
* Health check contract. |
| 4 |
* |
| 5 |
* @package Forge12\DoubleOptIn\Health |
| 6 |
* @since 5.3.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
declare( strict_types=1 ); |
| 10 |
|
| 11 |
namespace Forge12\DoubleOptIn\Health; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* A single runtime precondition that can be verified and reported. |
| 19 |
* |
| 20 |
* Implementations are cheap by contract: `run()` is called on every |
| 21 |
* Site Health page load and on every admin request that renders the |
| 22 |
* notice, so anything expensive has to be cached inside the check. |
| 23 |
* |
| 24 |
* Addons register their checks through the `f12_doi_health_checks` |
| 25 |
* filter rather than through a method on AddonInterface — that keeps |
| 26 |
* the addon loadable on Core versions that predate this API. |
| 27 |
*/ |
| 28 |
interface HealthCheckInterface { |
| 29 |
|
| 30 |
/** |
| 31 |
* Stable identifier, used as the Site Health test id. |
| 32 |
* |
| 33 |
* Must be prefixed with `f12_doi_` so it cannot collide with |
| 34 |
* another plugin's test — WordPress keys the global test array by |
| 35 |
* this string. |
| 36 |
*/ |
| 37 |
public function getId(): string; |
| 38 |
|
| 39 |
/** |
| 40 |
* Short human-readable name, shown as the test's row label in the |
| 41 |
* Site Health accordion. |
| 42 |
*/ |
| 43 |
public function getLabel(): string; |
| 44 |
|
| 45 |
/** |
| 46 |
* Which package this check belongs to (`core`, `opt-out`, …). |
| 47 |
* Used to group the Site Health → Info output. |
| 48 |
*/ |
| 49 |
public function getPackage(): string; |
| 50 |
|
| 51 |
/** |
| 52 |
* Evaluate the precondition. |
| 53 |
*/ |
| 54 |
public function run(): HealthCheckResult; |
| 55 |
} |
| 56 |
|