| 1 | <?php |
||
| 18 | class Wordlift_Key_Validation_Service { |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Validate the provided key. |
||
| 22 | * |
||
| 23 | * @since 3.9.0 |
||
| 24 | * |
||
| 25 | * @param string $key WordLift's key to validate. |
||
| 26 | * |
||
| 27 | * @return bool True if the key is valid, otherwise false. |
||
| 28 | */ |
||
| 29 | public function is_valid( $key ) { |
||
| 37 | |||
| 38 | /** |
||
| 39 | * This function is hooked to the `wl_validate_key` AJAX call. |
||
| 40 | * |
||
| 41 | * @since 3.9.0 |
||
| 42 | */ |
||
| 43 | public function validate_key() { |
||
| 57 | |||
| 58 | } |
||
| 59 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: