| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class WordPress\Plugin_Check\Checker\Checks\Abstract_Runtime_Check |
| 4 |
* |
| 5 |
* @package plugin-check |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WordPress\Plugin_Check\Checker\Checks; |
| 9 |
|
| 10 |
use Exception; |
| 11 |
use WordPress\Plugin_Check\Checker\Check_Result; |
| 12 |
use WordPress\Plugin_Check\Checker\Preparation; |
| 13 |
use WordPress\Plugin_Check\Checker\Runtime_Check; |
| 14 |
|
| 15 |
/** |
| 16 |
* Abstract Runtime Check class. |
| 17 |
* |
| 18 |
* @since 1.0.0 |
| 19 |
*/ |
| 20 |
abstract class Abstract_Runtime_Check implements Runtime_Check, Preparation { |
| 21 |
|
| 22 |
/** |
| 23 |
* Runs preparation step for the environment and returns a closure as a cleanup function. |
| 24 |
* |
| 25 |
* @since 1.0.0 |
| 26 |
* |
| 27 |
* @return callable Cleanup function to revert the changes made here. |
| 28 |
* |
| 29 |
* @throws Exception Thrown when preparation fails. |
| 30 |
*/ |
| 31 |
abstract public function prepare(); |
| 32 |
|
| 33 |
/** |
| 34 |
* Amends the given result by running the check on the associated plugin. |
| 35 |
* |
| 36 |
* @since 1.0.0 |
| 37 |
* |
| 38 |
* @param Check_Result $result The check result to amend, including the plugin context to check. |
| 39 |
* |
| 40 |
* @throws Exception Thrown when the check fails with a critical error (unrelated to any errors detected as part of |
| 41 |
* the check). |
| 42 |
*/ |
| 43 |
abstract public function run( Check_Result $result ); |
| 44 |
} |
| 45 |
|