Skip to content

Commit

Permalink
style: styleci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
samerton committed Mar 9, 2024
1 parent e9741dd commit bfb08ad
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
26 changes: 13 additions & 13 deletions core/classes/Core/Alert.php
Expand Up @@ -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
{
Expand All @@ -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,
Expand All @@ -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 = '')
Expand Down
5 changes: 3 additions & 2 deletions core/classes/Core/User.php
Expand Up @@ -1124,15 +1124,16 @@ public function savePlaceholders(int $server_id, array $placeholders): void
}

/**
* Get user's notification preferences
* Get user's notification preferences.
*
* TODO: return type (PHP 8)
*
* @param string $type Optional type of notification to filter by
*
* @return UserNotificationData|UserNotificationData[]|null
*/
public function getNotificationPreferences(string $type = '') {
public function getNotificationPreferences(string $type = '')
{
if ($this->exists()) {
$where = 'user_id = ?';
$whereVars = [$this->data()->id];
Expand Down
6 changes: 4 additions & 2 deletions core/classes/DTO/UserNotificationData.php
Expand Up @@ -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;
Expand Down
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;
Expand Down
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

use Phinx\Db\Adapter\MysqlAdapter;
Expand Down

0 comments on commit bfb08ad

Please sign in to comment.