| @@ -1,12 +1,20 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace FluentSupport\App\Modules; |
| 4 | 4 | |
| 5 | +/** | |
| 6 | + * Registry of notification integrations and their settings. | |
| 7 | + */ | |
| 5 | 8 | class IntegrationSettingsModule |
| 6 | 9 | { |
| 7 | 10 | private static $integrations = []; |
| 8 | 11 | |
| 12 | + /** | |
| 13 | + * @param string $integrationKey | |
| 14 | + * @param bool $withFields | |
| 15 | + * @return mixed|false False when the integration isn't registered. | |
| 16 | + */ | |
| 9 | 17 | public static function getSettings($integrationKey, $withFields = false) |
| 10 | 18 | { |
| 11 | 19 | $integrationClasses = self::$integrations; |
| 12 | 20 | |
| @@ -15,12 +23,16 @@ | ||
| 15 | 23 | if(!$class) { |
| 16 | 24 | return false; |
| 17 | 25 | } |
| 18 | 26 | |
| 19 | - | |
| 20 | 27 | return $class->getSettings($withFields); |
| 21 | 28 | } |
| 22 | 29 | |
| 30 | + /** | |
| 31 | + * @param string $integrationKey | |
| 32 | + * @param array $settings | |
| 33 | + * @return mixed|false False when the integration isn't registered. | |
| 34 | + */ | |
| 23 | 35 | public static function saveSettings($integrationKey, $settings) |
| 24 | 36 | { |
| 25 | 37 | $integrationClasses = self::$integrations; |
| 26 | 38 | |
| @@ -32,8 +44,11 @@ | ||
| 32 | 44 | |
| 33 | 45 | return $class->saveSettings($settings); |
| 34 | 46 | } |
| 35 | 47 | |
| 48 | + /** | |
| 49 | + * @param \FluentSupport\App\Services\Integrations\NotificationIntegrationBase $class | |
| 50 | + */ | |
| 36 | 51 | public static function addIntegration($class) |
| 37 | 52 | { |
| 38 | 53 | self::$integrations[$class->getKey()] = $class; |
| 39 | 54 | } |