| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class used to manage settings related to Account Protection. |
| 4 |
* |
| 5 |
* @package automattic/jetpack-account-protection |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Automattic\Jetpack\Account_Protection; |
| 9 |
|
| 10 |
/** |
| 11 |
* Account Protection Settings |
| 12 |
*/ |
| 13 |
class Settings { |
| 14 |
/** |
| 15 |
* Account protection instance. |
| 16 |
* |
| 17 |
* @var Account_Protection |
| 18 |
*/ |
| 19 |
private $account_protection; |
| 20 |
|
| 21 |
/** |
| 22 |
* Constructor for dependency injection. |
| 23 |
* |
| 24 |
* @param ?Account_Protection|null $account_protection Account protection dependency. |
| 25 |
*/ |
| 26 |
public function __construct( ?Account_Protection $account_protection = null ) { |
| 27 |
$this->account_protection = $account_protection ?? Account_Protection::instance(); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Get account protection settings. |
| 32 |
* |
| 33 |
* @return array |
| 34 |
*/ |
| 35 |
public function get() { |
| 36 |
$settings = array( |
| 37 |
'isEnabled' => $this->account_protection->is_enabled(), |
| 38 |
'isSupported' => $this->account_protection->is_supported_environment(), |
| 39 |
'hasUnsupportedJetpackVersion' => $this->account_protection->has_unsupported_jetpack_version(), |
| 40 |
); |
| 41 |
|
| 42 |
return $settings; |
| 43 |
} |
| 44 |
} |
| 45 |
|