PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.20
Booking for Appointments and Events Calendar – Amelia v1.2.20
2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Application / Commands / Settings / GetSettingsCommandHandler.php
ameliabooking / src / Application / Commands / Settings Last commit date
GetSettingsCommand.php 7 years ago GetSettingsCommandHandler.php 1 year ago UpdateSettingsCommand.php 7 years ago UpdateSettingsCommandHandler.php 1 year ago
GetSettingsCommandHandler.php
61 lines
1 <?php
2
3 namespace AmeliaBooking\Application\Commands\Settings;
4
5 use AmeliaBooking\Application\Commands\CommandHandler;
6 use AmeliaBooking\Application\Commands\CommandResult;
7 use AmeliaBooking\Application\Common\Exceptions\AccessDeniedException;
8 use AmeliaBooking\Domain\Entity\Entities;
9 use AmeliaBooking\Domain\Services\Settings\SettingsService;
10 use Interop\Container\Exception\ContainerException;
11
12 /**
13 * Class GetSettingsCommandHandler
14 *
15 * @package AmeliaBooking\Application\Commands\Settings
16 */
17 class GetSettingsCommandHandler extends CommandHandler
18 {
19 /**
20 * @return CommandResult
21 * @throws ContainerException
22 * @throws AccessDeniedException
23 */
24 public function handle(GetSettingsCommand $command)
25 {
26 $result = new CommandResult();
27
28 if (!$command->getPermissionService()->currentUserCanRead(Entities::SETTINGS)) {
29 throw new AccessDeniedException('You are not allowed to read settings.');
30 }
31
32 /** @var SettingsService $settingsService */
33 $settingsService = $this->getContainer()->get('domain.settings.service');
34
35 $settings = $settingsService->getAllSettingsCategorized();
36
37 if ($settings['activation']['purchaseCodeStore'] !== '' && $settings['activation']['active']) {
38 $settings['activation']['purchaseCodeStore'] = null;
39 }
40
41 if (!empty($settings['payments']['square'])) {
42 $settings['payments']['square']['phpVersion'] = phpversion();
43 }
44
45 $result->setResult(CommandResult::RESULT_SUCCESS);
46 $result->setMessage('Successfully retrieved settings.');
47
48 $settings = apply_filters('amelia_get_settings_filter', $settings);
49
50 do_action('amelia_get_settings', $settings);
51
52 $result->setData(
53 [
54 'settings' => $settings
55 ]
56 );
57
58 return $result;
59 }
60 }
61