From bfb08adcb1b4fa460fb3d04c33017037b03ffdd5 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 9 Mar 2024 20:37:19 +0000 Subject: [PATCH] style: styleci fixes --- core/classes/Core/Alert.php | 26 +++++++++---------- core/classes/Core/User.php | 5 ++-- core/classes/DTO/UserNotificationData.php | 6 +++-- ...e_users_notification_preferences_table.php | 1 + ...84810_add_content_rich_to_alerts_table.php | 1 + 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/core/classes/Core/Alert.php b/core/classes/Core/Alert.php index 7f504e3b51..4b62c02285 100644 --- a/core/classes/Core/Alert.php +++ b/core/classes/Core/Alert.php @@ -14,12 +14,12 @@ class Alert * * @deprecated Use Alert::send instead * - * @param int $user_id Contains the ID of the user who we are creating the alert for. - * @param string $type Contains the alert type, eg 'tag' for user tagging. - * @param array $text_short Contains the alert text in short form for the dropdown. - * @param array $text Contains full information about the alert. - * @param ?string $link Contains link to view the alert, defaults to #. - * @param ?string $content Optional alert content. + * @param int $user_id Contains the ID of the user who we are creating the alert for. + * @param string $type Contains the alert type, eg 'tag' for user tagging. + * @param array $text_short Contains the alert text in short form for the dropdown. + * @param array $text Contains full information about the alert. + * @param ?string $link Contains link to view the alert, defaults to #. + * @param ?string $content Optional alert content. */ public static function create(int $user_id, string $type, array $text_short, array $text, ?string $link = '#', string $content = null): void { @@ -33,8 +33,8 @@ public static function create(int $user_id, string $type, array $text_short, arr $language = new Language($text_short['path'], $language->first()->short_code); - $text_short = $text_short['content'] ?? str_replace(($text_short['replace'] ?? ''), ($text_short['replace_with'] ?? ''), $language->get($text_short['file'], $text_short['term'])); - $text = $text['content'] ?? str_replace(($text['replace'] ?? ''), ($text['replace_with'] ?? ''), $language->get($text['file'], $text['term'])); + $text_short = $text_short['content'] ?? str_replace($text_short['replace'] ?? '', $text_short['replace_with'] ?? '', $language->get($text_short['file'], $text_short['term'])); + $text = $text['content'] ?? str_replace($text['replace'] ?? '', $text['replace_with'] ?? '', $language->get($text['file'], $text['term'])); $db->insert('alerts', [ 'user_id' => $user_id, @@ -48,12 +48,12 @@ public static function create(int $user_id, string $type, array $text_short, arr } /** - * Post a new alert to a user + * Post a new alert to a user. * - * @param int $userId - * @param string $title - * @param string $content - * @param string|null $link Optional link to redirect the user to on click + * @param int $userId + * @param string $title + * @param string $content + * @param string|null $link Optional link to redirect the user to on click * @return void */ public static function send(int $userId, string $title, string $content, ?string $link = '') diff --git a/core/classes/Core/User.php b/core/classes/Core/User.php index 4ee14c2571..27f04ec49d 100644 --- a/core/classes/Core/User.php +++ b/core/classes/Core/User.php @@ -1124,7 +1124,7 @@ public function savePlaceholders(int $server_id, array $placeholders): void } /** - * Get user's notification preferences + * Get user's notification preferences. * * TODO: return type (PHP 8) * @@ -1132,7 +1132,8 @@ public function savePlaceholders(int $server_id, array $placeholders): void * * @return UserNotificationData|UserNotificationData[]|null */ - public function getNotificationPreferences(string $type = '') { + public function getNotificationPreferences(string $type = '') + { if ($this->exists()) { $where = 'user_id = ?'; $whereVars = [$this->data()->id]; diff --git a/core/classes/DTO/UserNotificationData.php b/core/classes/DTO/UserNotificationData.php index bac29783a2..54fb9460aa 100644 --- a/core/classes/DTO/UserNotificationData.php +++ b/core/classes/DTO/UserNotificationData.php @@ -7,12 +7,14 @@ * @version 2.2.0 * @license MIT */ -class UserNotificationData { +class UserNotificationData +{ public bool $alert; public bool $email; public string $type; - public function __construct(object $row) { + public function __construct(object $row) + { $this->alert = $row->alert; $this->email = $row->email; $this->type = $row->type; diff --git a/core/migrations/20230908180037_create_users_notification_preferences_table.php b/core/migrations/20230908180037_create_users_notification_preferences_table.php index dd04cf4a6e..f5a077bce4 100644 --- a/core/migrations/20230908180037_create_users_notification_preferences_table.php +++ b/core/migrations/20230908180037_create_users_notification_preferences_table.php @@ -1,4 +1,5 @@