summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis <louis@chmn.me>2024-01-03 15:54:24 +0100
committerGitHub <noreply@github.com>2024-01-03 15:54:24 +0100
commita64df1908bb10b103ce98235ff21d0087d6978d7 (patch)
treef23b17286865b5093728152f59e931a88e7a69f1
parent29e6f062d533361adff9931f5cf91bb270a8c8bf (diff)
parent799928c63db0cd13fe80e7561fa9ac0a0200f95f (diff)
downloadnextcloud-server-a64df1908bb10b103ce98235ff21d0087d6978d7.tar.gz
nextcloud-server-a64df1908bb10b103ce98235ff21d0087d6978d7.zip
Merge pull request #39174 from shdehnavi/refactor_lib_private_notification
refactor lib/private/Notification
-rw-r--r--lib/private/Notification/Action.php18
-rw-r--r--lib/private/Notification/Manager.php45
-rw-r--r--lib/private/Notification/Notification.php71
3 files changed, 46 insertions, 88 deletions
diff --git a/lib/private/Notification/Action.php b/lib/private/Notification/Action.php
index ff9cf9e38f5..9590d28af4a 100644
--- a/lib/private/Notification/Action.php
+++ b/lib/private/Notification/Action.php
@@ -27,23 +27,17 @@ namespace OC\Notification;
use OCP\Notification\IAction;
class Action implements IAction {
- /** @var string */
- protected $label;
+ protected string $label;
- /** @var string */
- protected $labelParsed;
+ protected string $labelParsed;
- /** @var string */
- protected $link;
+ protected string $link;
- /** @var string */
- protected $requestType;
+ protected string $requestType;
- /** @var string */
- protected $icon;
+ protected string $icon;
- /** @var bool */
- protected $primary;
+ protected bool $primary;
public function __construct() {
$this->label = '';
diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php
index e81b6c4fa35..c712d2754e2 100644
--- a/lib/private/Notification/Manager.php
+++ b/lib/private/Notification/Manager.php
@@ -43,48 +43,35 @@ use Psr\Container\ContainerExceptionInterface;
use Psr\Log\LoggerInterface;
class Manager implements IManager {
- /** @var IValidator */
- protected $validator;
- /** @var IUserManager */
- private $userManager;
/** @var ICache */
- protected $cache;
- /** @var IRegistry */
- protected $subscription;
- /** @var LoggerInterface */
- protected $logger;
- /** @var Coordinator */
- private $coordinator;
+ protected ICache $cache;
/** @var IApp[] */
- protected $apps;
+ protected array $apps;
/** @var string[] */
- protected $appClasses;
+ protected array $appClasses;
/** @var INotifier[] */
- protected $notifiers;
+ protected array $notifiers;
/** @var string[] */
- protected $notifierClasses;
+ protected array $notifierClasses;
/** @var bool */
- protected $preparingPushNotification;
+ protected bool $preparingPushNotification;
/** @var bool */
- protected $deferPushing;
+ protected bool $deferPushing;
/** @var bool */
- private $parsedRegistrationContext;
+ private bool $parsedRegistrationContext;
- public function __construct(IValidator $validator,
- IUserManager $userManager,
+ public function __construct(
+ protected IValidator $validator,
+ private IUserManager $userManager,
ICacheFactory $cacheFactory,
- IRegistry $subscription,
- LoggerInterface $logger,
- Coordinator $coordinator) {
- $this->validator = $validator;
- $this->userManager = $userManager;
+ protected IRegistry $subscription,
+ protected LoggerInterface $logger,
+ private Coordinator $coordinator,
+ ) {
$this->cache = $cacheFactory->createDistributed('notifications');
- $this->subscription = $subscription;
- $this->logger = $logger;
- $this->coordinator = $coordinator;
$this->apps = [];
$this->notifiers = [];
@@ -111,7 +98,7 @@ class Manager implements IManager {
* @deprecated 17.0.0 use registerNotifierService instead.
* @since 8.2.0 - Parameter $info was added in 9.0.0
*/
- public function registerNotifier(\Closure $service, \Closure $info) {
+ public function registerNotifier(\Closure $service, \Closure $info): void {
$infoData = $info();
$exception = new \InvalidArgumentException(
'Notifier ' . $infoData['name'] . ' (id: ' . $infoData['id'] . ') is not considered because it is using the old way to register.'
diff --git a/lib/private/Notification/Notification.php b/lib/private/Notification/Notification.php
index 2291c4ae34f..9222f3cb0e3 100644
--- a/lib/private/Notification/Notification.php
+++ b/lib/private/Notification/Notification.php
@@ -32,74 +32,51 @@ use OCP\RichObjectStrings\InvalidObjectExeption;
use OCP\RichObjectStrings\IValidator;
class Notification implements INotification {
- /** @var IValidator */
- protected $richValidator;
+ protected string $app;
- /** @var string */
- protected $app;
+ protected string $user;
- /** @var string */
- protected $user;
+ protected \DateTime $dateTime;
- /** @var \DateTime */
- protected $dateTime;
+ protected string $objectType;
- /** @var string */
- protected $objectType;
+ protected string $objectId;
- /** @var string */
- protected $objectId;
+ protected string $subject;
- /** @var string */
- protected $subject;
+ protected array $subjectParameters;
- /** @var array */
- protected $subjectParameters;
+ protected string $subjectParsed;
- /** @var string */
- protected $subjectParsed;
+ protected string $subjectRich;
- /** @var string */
- protected $subjectRich;
+ protected array $subjectRichParameters;
- /** @var array */
- protected $subjectRichParameters;
+ protected string $message;
- /** @var string */
- protected $message;
+ protected array $messageParameters;
- /** @var array */
- protected $messageParameters;
+ protected string $messageParsed;
- /** @var string */
- protected $messageParsed;
+ protected string $messageRich;
- /** @var string */
- protected $messageRich;
+ protected array $messageRichParameters;
- /** @var array */
- protected $messageRichParameters;
+ protected string $link;
- /** @var string */
- protected $link;
+ protected string $icon;
- /** @var string */
- protected $icon;
+ protected array $actions;
- /** @var array */
- protected $actions;
+ protected array $actionsParsed;
- /** @var array */
- protected $actionsParsed;
+ protected bool $hasPrimaryAction;
- /** @var bool */
- protected $hasPrimaryAction;
+ protected bool $hasPrimaryParsedAction;
- /** @var bool */
- protected $hasPrimaryParsedAction;
-
- public function __construct(IValidator $richValidator) {
- $this->richValidator = $richValidator;
+ public function __construct(
+ protected IValidator $richValidator,
+ ) {
$this->app = '';
$this->user = '';
$this->dateTime = new \DateTime();