@@ -31,41 +31,41 @@ |
||
31 | 31 | */ |
32 | 32 | interface IManager { |
33 | 33 | |
34 | - /** |
|
35 | - * Registers a resource backend |
|
36 | - * |
|
37 | - * @param string $backendClass |
|
38 | - * @return void |
|
39 | - * @since 14.0.0 |
|
40 | - */ |
|
41 | - public function registerBackend(string $backendClass); |
|
34 | + /** |
|
35 | + * Registers a resource backend |
|
36 | + * |
|
37 | + * @param string $backendClass |
|
38 | + * @return void |
|
39 | + * @since 14.0.0 |
|
40 | + */ |
|
41 | + public function registerBackend(string $backendClass); |
|
42 | 42 | |
43 | - /** |
|
44 | - * Unregisters a resource backend |
|
45 | - * |
|
46 | - * @param string $backendClass |
|
47 | - * @return void |
|
48 | - * @since 14.0.0 |
|
49 | - */ |
|
50 | - public function unregisterBackend(string $backendClass); |
|
43 | + /** |
|
44 | + * Unregisters a resource backend |
|
45 | + * |
|
46 | + * @param string $backendClass |
|
47 | + * @return void |
|
48 | + * @since 14.0.0 |
|
49 | + */ |
|
50 | + public function unregisterBackend(string $backendClass); |
|
51 | 51 | |
52 | - /** |
|
53 | - * @return IBackend[] |
|
54 | - * @since 14.0.0 |
|
55 | - */ |
|
56 | - public function getBackends():array; |
|
52 | + /** |
|
53 | + * @return IBackend[] |
|
54 | + * @since 14.0.0 |
|
55 | + */ |
|
56 | + public function getBackends():array; |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param string $backendId |
|
60 | - * @return IBackend|null |
|
61 | - * @since 14.0.0 |
|
62 | - */ |
|
63 | - public function getBackend($backendId); |
|
58 | + /** |
|
59 | + * @param string $backendId |
|
60 | + * @return IBackend|null |
|
61 | + * @since 14.0.0 |
|
62 | + */ |
|
63 | + public function getBackend($backendId); |
|
64 | 64 | |
65 | - /** |
|
66 | - * removes all registered backend instances |
|
67 | - * @return void |
|
68 | - * @since 14.0.0 |
|
69 | - */ |
|
70 | - public function clear(); |
|
65 | + /** |
|
66 | + * removes all registered backend instances |
|
67 | + * @return void |
|
68 | + * @since 14.0.0 |
|
69 | + */ |
|
70 | + public function clear(); |
|
71 | 71 | } |
@@ -31,41 +31,41 @@ |
||
31 | 31 | */ |
32 | 32 | interface IManager { |
33 | 33 | |
34 | - /** |
|
35 | - * Registers a room backend |
|
36 | - * |
|
37 | - * @param string $backendClass |
|
38 | - * @return void |
|
39 | - * @since 14.0.0 |
|
40 | - */ |
|
41 | - public function registerBackend(string $backendClass); |
|
34 | + /** |
|
35 | + * Registers a room backend |
|
36 | + * |
|
37 | + * @param string $backendClass |
|
38 | + * @return void |
|
39 | + * @since 14.0.0 |
|
40 | + */ |
|
41 | + public function registerBackend(string $backendClass); |
|
42 | 42 | |
43 | - /** |
|
44 | - * Unregisters a room backend |
|
45 | - * |
|
46 | - * @param string $backendClass |
|
47 | - * @return void |
|
48 | - * @since 14.0.0 |
|
49 | - */ |
|
50 | - public function unregisterBackend(string $backendClass); |
|
43 | + /** |
|
44 | + * Unregisters a room backend |
|
45 | + * |
|
46 | + * @param string $backendClass |
|
47 | + * @return void |
|
48 | + * @since 14.0.0 |
|
49 | + */ |
|
50 | + public function unregisterBackend(string $backendClass); |
|
51 | 51 | |
52 | - /** |
|
53 | - * @return IBackend[] |
|
54 | - * @since 14.0.0 |
|
55 | - */ |
|
56 | - public function getBackends():array; |
|
52 | + /** |
|
53 | + * @return IBackend[] |
|
54 | + * @since 14.0.0 |
|
55 | + */ |
|
56 | + public function getBackends():array; |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param string $backendId |
|
60 | - * @return IBackend|null |
|
61 | - * @since 14.0.0 |
|
62 | - */ |
|
63 | - public function getBackend($backendId); |
|
58 | + /** |
|
59 | + * @param string $backendId |
|
60 | + * @return IBackend|null |
|
61 | + * @since 14.0.0 |
|
62 | + */ |
|
63 | + public function getBackend($backendId); |
|
64 | 64 | |
65 | - /** |
|
66 | - * removes all registered backend instances |
|
67 | - * @return void |
|
68 | - * @since 14.0.0 |
|
69 | - */ |
|
70 | - public function clear(); |
|
65 | + /** |
|
66 | + * removes all registered backend instances |
|
67 | + * @return void |
|
68 | + * @since 14.0.0 |
|
69 | + */ |
|
70 | + public function clear(); |
|
71 | 71 | } |
@@ -26,34 +26,34 @@ |
||
26 | 26 | |
27 | 27 | class AppManagement extends Action { |
28 | 28 | |
29 | - /** |
|
30 | - * @param string $appName |
|
31 | - */ |
|
32 | - public function enableApp(string $appName) { |
|
33 | - $this->log('App "%s" enabled', |
|
34 | - ['app' => $appName], |
|
35 | - ['app'] |
|
36 | - ); |
|
37 | - } |
|
29 | + /** |
|
30 | + * @param string $appName |
|
31 | + */ |
|
32 | + public function enableApp(string $appName) { |
|
33 | + $this->log('App "%s" enabled', |
|
34 | + ['app' => $appName], |
|
35 | + ['app'] |
|
36 | + ); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param string $appName |
|
41 | - * @param string[] $groups |
|
42 | - */ |
|
43 | - public function enableAppForGroups(string $appName, array $groups) { |
|
44 | - $this->log('App "%1$s" enabled for groups: %2$s', |
|
45 | - ['app' => $appName, 'groups' => implode(', ', $groups)], |
|
46 | - ['app', 'groups'] |
|
47 | - ); |
|
48 | - } |
|
39 | + /** |
|
40 | + * @param string $appName |
|
41 | + * @param string[] $groups |
|
42 | + */ |
|
43 | + public function enableAppForGroups(string $appName, array $groups) { |
|
44 | + $this->log('App "%1$s" enabled for groups: %2$s', |
|
45 | + ['app' => $appName, 'groups' => implode(', ', $groups)], |
|
46 | + ['app', 'groups'] |
|
47 | + ); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param string $appName |
|
52 | - */ |
|
53 | - public function disableApp(string $appName) { |
|
54 | - $this->log('App "%s" disabled', |
|
55 | - ['app' => $appName], |
|
56 | - ['app'] |
|
57 | - ); |
|
58 | - } |
|
50 | + /** |
|
51 | + * @param string $appName |
|
52 | + */ |
|
53 | + public function disableApp(string $appName) { |
|
54 | + $this->log('App "%s" disabled', |
|
55 | + ['app' => $appName], |
|
56 | + ['app'] |
|
57 | + ); |
|
58 | + } |
|
59 | 59 | } |
@@ -32,19 +32,19 @@ |
||
32 | 32 | */ |
33 | 33 | class ProviderAlreadyExistsException extends HintException { |
34 | 34 | |
35 | - /** |
|
36 | - * ProviderAlreadyExistsException constructor. |
|
37 | - * |
|
38 | - * @since 14.0.0 |
|
39 | - * |
|
40 | - * @param string $newProviderId cloud federation provider ID of the new provider |
|
41 | - * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
42 | - */ |
|
43 | - public function __construct($newProviderId, $existingProviderName) { |
|
44 | - $l = \OC::$server->getL10N('federation'); |
|
45 | - $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
46 | - $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
|
47 | - parent::__construct($message, $hint); |
|
48 | - } |
|
35 | + /** |
|
36 | + * ProviderAlreadyExistsException constructor. |
|
37 | + * |
|
38 | + * @since 14.0.0 |
|
39 | + * |
|
40 | + * @param string $newProviderId cloud federation provider ID of the new provider |
|
41 | + * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
42 | + */ |
|
43 | + public function __construct($newProviderId, $existingProviderName) { |
|
44 | + $l = \OC::$server->getL10N('federation'); |
|
45 | + $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
46 | + $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
|
47 | + parent::__construct($message, $hint); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function __construct($newProviderId, $existingProviderName) { |
44 | 44 | $l = \OC::$server->getL10N('federation'); |
45 | - $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
45 | + $message = 'ID "'.$newProviderId.'" already used by cloud federation provider "'.$existingProviderName.'"'; |
|
46 | 46 | $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
47 | 47 | parent::__construct($message, $hint); |
48 | 48 | } |
@@ -8,6 +8,6 @@ |
||
8 | 8 | </p> |
9 | 9 | <br /> |
10 | 10 | <p> |
11 | - <?php print_unescaped($l->t('Further information how to configure this can be found in the %1$sdocumentation%2$s.', ['<a href="' . $_['docUrl'] . '" target="blank">', '</a>'])); ?> |
|
11 | + <?php print_unescaped($l->t('Further information how to configure this can be found in the %1$sdocumentation%2$s.', ['<a href="'.$_['docUrl'].'" target="blank">', '</a>'])); ?> |
|
12 | 12 | </p> |
13 | 13 | </div> |
@@ -31,18 +31,18 @@ |
||
31 | 31 | */ |
32 | 32 | interface ITimeFactory { |
33 | 33 | |
34 | - /** |
|
35 | - * @return int the result of a call to time() |
|
36 | - * @since 8.0.0 |
|
37 | - */ |
|
38 | - public function getTime(): int; |
|
34 | + /** |
|
35 | + * @return int the result of a call to time() |
|
36 | + * @since 8.0.0 |
|
37 | + */ |
|
38 | + public function getTime(): int; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @param string $time |
|
42 | - * @param \DateTimeZone $timezone |
|
43 | - * @return \DateTime |
|
44 | - * @since 15.0.0 |
|
45 | - */ |
|
46 | - public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime; |
|
40 | + /** |
|
41 | + * @param string $time |
|
42 | + * @param \DateTimeZone $timezone |
|
43 | + * @return \DateTime |
|
44 | + * @since 15.0.0 |
|
45 | + */ |
|
46 | + public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime; |
|
47 | 47 | |
48 | 48 | } |
@@ -34,21 +34,21 @@ |
||
34 | 34 | class TimeFactory implements ITimeFactory { |
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @return int the result of a call to time() |
|
39 | - */ |
|
40 | - public function getTime(): int { |
|
41 | - return time(); |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * @param string $time |
|
46 | - * @param \DateTimeZone $timezone |
|
47 | - * @return \DateTime |
|
48 | - * @since 15.0.0 |
|
49 | - */ |
|
50 | - public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime { |
|
51 | - return new \DateTime($time, $timezone); |
|
52 | - } |
|
37 | + /** |
|
38 | + * @return int the result of a call to time() |
|
39 | + */ |
|
40 | + public function getTime(): int { |
|
41 | + return time(); |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * @param string $time |
|
46 | + * @param \DateTimeZone $timezone |
|
47 | + * @return \DateTime |
|
48 | + * @since 15.0.0 |
|
49 | + */ |
|
50 | + public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime { |
|
51 | + return new \DateTime($time, $timezone); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | } |
@@ -36,81 +36,81 @@ |
||
36 | 36 | |
37 | 37 | class Enforce extends Command { |
38 | 38 | |
39 | - /** @var MandatoryTwoFactor */ |
|
40 | - private $mandatoryTwoFactor; |
|
39 | + /** @var MandatoryTwoFactor */ |
|
40 | + private $mandatoryTwoFactor; |
|
41 | 41 | |
42 | - public function __construct(MandatoryTwoFactor $mandatoryTwoFactor) { |
|
43 | - parent::__construct(); |
|
42 | + public function __construct(MandatoryTwoFactor $mandatoryTwoFactor) { |
|
43 | + parent::__construct(); |
|
44 | 44 | |
45 | - $this->mandatoryTwoFactor = $mandatoryTwoFactor; |
|
46 | - } |
|
45 | + $this->mandatoryTwoFactor = $mandatoryTwoFactor; |
|
46 | + } |
|
47 | 47 | |
48 | - protected function configure() { |
|
49 | - $this->setName('twofactorauth:enforce'); |
|
50 | - $this->setDescription('Enabled/disable enforced two-factor authentication'); |
|
51 | - $this->addOption( |
|
52 | - 'on', |
|
53 | - null, |
|
54 | - InputOption::VALUE_NONE, |
|
55 | - 'enforce two-factor authentication' |
|
56 | - ); |
|
57 | - $this->addOption( |
|
58 | - 'off', |
|
59 | - null, |
|
60 | - InputOption::VALUE_NONE, |
|
61 | - 'don\'t enforce two-factor authenticaton' |
|
62 | - ); |
|
63 | - $this->addOption( |
|
64 | - 'group', |
|
65 | - null, |
|
66 | - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
67 | - 'enforce only for the given group(s)' |
|
68 | - ); |
|
69 | - $this->addOption( |
|
70 | - 'exclude', |
|
71 | - null, |
|
72 | - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
73 | - 'exclude mandatory two-factor auth for the given group(s)' |
|
74 | - ); |
|
75 | - } |
|
48 | + protected function configure() { |
|
49 | + $this->setName('twofactorauth:enforce'); |
|
50 | + $this->setDescription('Enabled/disable enforced two-factor authentication'); |
|
51 | + $this->addOption( |
|
52 | + 'on', |
|
53 | + null, |
|
54 | + InputOption::VALUE_NONE, |
|
55 | + 'enforce two-factor authentication' |
|
56 | + ); |
|
57 | + $this->addOption( |
|
58 | + 'off', |
|
59 | + null, |
|
60 | + InputOption::VALUE_NONE, |
|
61 | + 'don\'t enforce two-factor authenticaton' |
|
62 | + ); |
|
63 | + $this->addOption( |
|
64 | + 'group', |
|
65 | + null, |
|
66 | + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
67 | + 'enforce only for the given group(s)' |
|
68 | + ); |
|
69 | + $this->addOption( |
|
70 | + 'exclude', |
|
71 | + null, |
|
72 | + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
73 | + 'exclude mandatory two-factor auth for the given group(s)' |
|
74 | + ); |
|
75 | + } |
|
76 | 76 | |
77 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
78 | - if ($input->getOption('on')) { |
|
79 | - $enforcedGroups = $input->getOption('group'); |
|
80 | - $excludedGroups = $input->getOption('exclude'); |
|
81 | - $this->mandatoryTwoFactor->setState(new EnforcementState(true, $enforcedGroups, $excludedGroups)); |
|
82 | - } elseif ($input->getOption('off')) { |
|
83 | - $this->mandatoryTwoFactor->setState(new EnforcementState(false)); |
|
84 | - } |
|
77 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
78 | + if ($input->getOption('on')) { |
|
79 | + $enforcedGroups = $input->getOption('group'); |
|
80 | + $excludedGroups = $input->getOption('exclude'); |
|
81 | + $this->mandatoryTwoFactor->setState(new EnforcementState(true, $enforcedGroups, $excludedGroups)); |
|
82 | + } elseif ($input->getOption('off')) { |
|
83 | + $this->mandatoryTwoFactor->setState(new EnforcementState(false)); |
|
84 | + } |
|
85 | 85 | |
86 | - $state = $this->mandatoryTwoFactor->getState(); |
|
87 | - if ($state->isEnforced()) { |
|
88 | - $this->writeEnforced($output, $state); |
|
89 | - } else { |
|
90 | - $this->writeNotEnforced($output); |
|
91 | - } |
|
92 | - } |
|
86 | + $state = $this->mandatoryTwoFactor->getState(); |
|
87 | + if ($state->isEnforced()) { |
|
88 | + $this->writeEnforced($output, $state); |
|
89 | + } else { |
|
90 | + $this->writeNotEnforced($output); |
|
91 | + } |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * @param OutputInterface $output |
|
96 | - */ |
|
97 | - protected function writeEnforced(OutputInterface $output, EnforcementState $state) { |
|
98 | - if (empty($state->getEnforcedGroups())) { |
|
99 | - $message = 'Two-factor authentication is enforced for all users'; |
|
100 | - } else { |
|
101 | - $message = 'Two-factor authentication is enforced for members of the group(s) ' . implode(', ', $state->getEnforcedGroups()); |
|
102 | - } |
|
103 | - if (!empty($state->getExcludedGroups())) { |
|
104 | - $message .= ', except members of ' . implode(', ', $state->getExcludedGroups()); |
|
105 | - } |
|
106 | - $output->writeln($message); |
|
107 | - } |
|
94 | + /** |
|
95 | + * @param OutputInterface $output |
|
96 | + */ |
|
97 | + protected function writeEnforced(OutputInterface $output, EnforcementState $state) { |
|
98 | + if (empty($state->getEnforcedGroups())) { |
|
99 | + $message = 'Two-factor authentication is enforced for all users'; |
|
100 | + } else { |
|
101 | + $message = 'Two-factor authentication is enforced for members of the group(s) ' . implode(', ', $state->getEnforcedGroups()); |
|
102 | + } |
|
103 | + if (!empty($state->getExcludedGroups())) { |
|
104 | + $message .= ', except members of ' . implode(', ', $state->getExcludedGroups()); |
|
105 | + } |
|
106 | + $output->writeln($message); |
|
107 | + } |
|
108 | 108 | |
109 | - /** |
|
110 | - * @param OutputInterface $output |
|
111 | - */ |
|
112 | - protected function writeNotEnforced(OutputInterface $output) { |
|
113 | - $output->writeln('Two-factor authentication is not enforced'); |
|
114 | - } |
|
109 | + /** |
|
110 | + * @param OutputInterface $output |
|
111 | + */ |
|
112 | + protected function writeNotEnforced(OutputInterface $output) { |
|
113 | + $output->writeln('Two-factor authentication is not enforced'); |
|
114 | + } |
|
115 | 115 | |
116 | 116 | } |
@@ -98,10 +98,10 @@ |
||
98 | 98 | if (empty($state->getEnforcedGroups())) { |
99 | 99 | $message = 'Two-factor authentication is enforced for all users'; |
100 | 100 | } else { |
101 | - $message = 'Two-factor authentication is enforced for members of the group(s) ' . implode(', ', $state->getEnforcedGroups()); |
|
101 | + $message = 'Two-factor authentication is enforced for members of the group(s) '.implode(', ', $state->getEnforcedGroups()); |
|
102 | 102 | } |
103 | 103 | if (!empty($state->getExcludedGroups())) { |
104 | - $message .= ', except members of ' . implode(', ', $state->getExcludedGroups()); |
|
104 | + $message .= ', except members of '.implode(', ', $state->getExcludedGroups()); |
|
105 | 105 | } |
106 | 106 | $output->writeln($message); |
107 | 107 | } |
@@ -46,103 +46,103 @@ |
||
46 | 46 | class DashboardManager implements IDashboardManager { |
47 | 47 | |
48 | 48 | |
49 | - /** @var IWidgetsService */ |
|
50 | - private $widgetsService; |
|
51 | - |
|
52 | - /** @var IEventsService */ |
|
53 | - private $eventsService; |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * @param IEventsService $eventsService |
|
58 | - */ |
|
59 | - public function registerEventsService(IEventsService $eventsService) { |
|
60 | - $this->eventsService = $eventsService; |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * @param IWidgetsService $widgetsService |
|
66 | - */ |
|
67 | - public function registerWidgetsService(IWidgetsService $widgetsService) { |
|
68 | - $this->widgetsService = $widgetsService; |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * @param string $widgetId |
|
74 | - * @param string $userId |
|
75 | - * |
|
76 | - * @return IWidgetConfig |
|
77 | - * @throws DashboardAppNotAvailableException |
|
78 | - */ |
|
79 | - public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig { |
|
80 | - return $this->getWidgetsService()->getWidgetConfig($widgetId, $userId); |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * @param string $widgetId |
|
86 | - * @param array $users |
|
87 | - * @param array $payload |
|
88 | - * @param string $uniqueId |
|
89 | - * |
|
90 | - * @throws DashboardAppNotAvailableException |
|
91 | - */ |
|
92 | - public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = '') { |
|
93 | - $this->getEventsService()->createUsersEvent($widgetId, $users, $payload, $uniqueId); |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @param string $widgetId |
|
99 | - * @param array $groups |
|
100 | - * @param array $payload |
|
101 | - * @param string $uniqueId |
|
102 | - * |
|
103 | - * @throws DashboardAppNotAvailableException |
|
104 | - */ |
|
105 | - public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = '') { |
|
106 | - $this->getEventsService()->createGroupsEvent($widgetId, $groups, $payload, $uniqueId); |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * @param string $widgetId |
|
112 | - * @param array $payload |
|
113 | - * @param string $uniqueId |
|
114 | - * |
|
115 | - * @throws DashboardAppNotAvailableException |
|
116 | - */ |
|
117 | - public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = '') { |
|
118 | - $this->getEventsService()->createGlobalEvent($widgetId, $payload, $uniqueId); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @return IWidgetsService |
|
124 | - * @throws DashboardAppNotAvailableException |
|
125 | - */ |
|
126 | - private function getWidgetsService() { |
|
127 | - if ($this->widgetsService === null) { |
|
128 | - throw new DashboardAppNotAvailableException('No IWidgetsService registered'); |
|
129 | - } |
|
130 | - |
|
131 | - return $this->widgetsService; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * @return IEventsService |
|
137 | - * @throws DashboardAppNotAvailableException |
|
138 | - */ |
|
139 | - private function getEventsService() { |
|
140 | - if ($this->eventsService === null) { |
|
141 | - throw new DashboardAppNotAvailableException('No IEventsService registered'); |
|
142 | - } |
|
143 | - |
|
144 | - return $this->eventsService; |
|
145 | - } |
|
49 | + /** @var IWidgetsService */ |
|
50 | + private $widgetsService; |
|
51 | + |
|
52 | + /** @var IEventsService */ |
|
53 | + private $eventsService; |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * @param IEventsService $eventsService |
|
58 | + */ |
|
59 | + public function registerEventsService(IEventsService $eventsService) { |
|
60 | + $this->eventsService = $eventsService; |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * @param IWidgetsService $widgetsService |
|
66 | + */ |
|
67 | + public function registerWidgetsService(IWidgetsService $widgetsService) { |
|
68 | + $this->widgetsService = $widgetsService; |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * @param string $widgetId |
|
74 | + * @param string $userId |
|
75 | + * |
|
76 | + * @return IWidgetConfig |
|
77 | + * @throws DashboardAppNotAvailableException |
|
78 | + */ |
|
79 | + public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig { |
|
80 | + return $this->getWidgetsService()->getWidgetConfig($widgetId, $userId); |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * @param string $widgetId |
|
86 | + * @param array $users |
|
87 | + * @param array $payload |
|
88 | + * @param string $uniqueId |
|
89 | + * |
|
90 | + * @throws DashboardAppNotAvailableException |
|
91 | + */ |
|
92 | + public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = '') { |
|
93 | + $this->getEventsService()->createUsersEvent($widgetId, $users, $payload, $uniqueId); |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @param string $widgetId |
|
99 | + * @param array $groups |
|
100 | + * @param array $payload |
|
101 | + * @param string $uniqueId |
|
102 | + * |
|
103 | + * @throws DashboardAppNotAvailableException |
|
104 | + */ |
|
105 | + public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = '') { |
|
106 | + $this->getEventsService()->createGroupsEvent($widgetId, $groups, $payload, $uniqueId); |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * @param string $widgetId |
|
112 | + * @param array $payload |
|
113 | + * @param string $uniqueId |
|
114 | + * |
|
115 | + * @throws DashboardAppNotAvailableException |
|
116 | + */ |
|
117 | + public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = '') { |
|
118 | + $this->getEventsService()->createGlobalEvent($widgetId, $payload, $uniqueId); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @return IWidgetsService |
|
124 | + * @throws DashboardAppNotAvailableException |
|
125 | + */ |
|
126 | + private function getWidgetsService() { |
|
127 | + if ($this->widgetsService === null) { |
|
128 | + throw new DashboardAppNotAvailableException('No IWidgetsService registered'); |
|
129 | + } |
|
130 | + |
|
131 | + return $this->widgetsService; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * @return IEventsService |
|
137 | + * @throws DashboardAppNotAvailableException |
|
138 | + */ |
|
139 | + private function getEventsService() { |
|
140 | + if ($this->eventsService === null) { |
|
141 | + throw new DashboardAppNotAvailableException('No IEventsService registered'); |
|
142 | + } |
|
143 | + |
|
144 | + return $this->eventsService; |
|
145 | + } |
|
146 | 146 | |
147 | 147 | } |
148 | 148 |