Config
4 years ago
Helpers
4 years ago
Migrations
4 years ago
Routes
1 year ago
Setup
11 months ago
Wizard
1 year ago
BlockFactory.php
1 year ago
DefaultFormFactory.php
1 year ago
FormRepository.php
1 year ago
LocaleCollection.php
4 years ago
SettingsRepository.php
4 years ago
SettingsRepositoryFactory.php
4 years ago
SettingsRepositoryFactory.php
28 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Onboarding; |
| 4 | |
| 5 | /** |
| 6 | * @since 2.8.0 |
| 7 | */ |
| 8 | class SettingsRepositoryFactory |
| 9 | { |
| 10 | |
| 11 | /** |
| 12 | * @since 2.8.0 |
| 13 | * |
| 14 | * @param string $optionName |
| 15 | * |
| 16 | */ |
| 17 | public function make($optionName) |
| 18 | { |
| 19 | $option = get_option($optionName, []); |
| 20 | |
| 21 | $persistCallback = function ($settings) use ($optionName) { |
| 22 | return update_option($optionName, $settings); |
| 23 | }; |
| 24 | |
| 25 | return new SettingsRepository($option, $persistCallback); |
| 26 | } |
| 27 | } |
| 28 |