| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package Polylang |
| 4 |
*/ |
| 5 |
|
| 6 |
namespace WP_Syntex\Polylang\Options\Primitive; |
| 7 |
|
| 8 |
use WP_Syntex\Polylang\Options\Abstract_Option; |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) || exit; |
| 11 |
|
| 12 |
/** |
| 13 |
* Class defining single boolean option. |
| 14 |
* Note that for historic reason, boolean are stored as 0 or 1. |
| 15 |
* |
| 16 |
* @since 3.7 |
| 17 |
*/ |
| 18 |
abstract class Abstract_Boolean extends Abstract_Option { |
| 19 |
/** |
| 20 |
* Returns the default value. |
| 21 |
* |
| 22 |
* @since 3.7 |
| 23 |
* |
| 24 |
* @return bool |
| 25 |
*/ |
| 26 |
protected function get_default() { |
| 27 |
return false; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Returns the JSON schema part specific to this option. |
| 32 |
* |
| 33 |
* @since 3.7 |
| 34 |
* |
| 35 |
* @return array Partial schema. |
| 36 |
* |
| 37 |
* @phpstan-return array{type: 'boolean'} |
| 38 |
*/ |
| 39 |
protected function get_data_structure(): array { |
| 40 |
return array( |
| 41 |
'type' => 'boolean', |
| 42 |
); |
| 43 |
} |
| 44 |
} |
| 45 |
|