summaryrefslogtreecommitdiffstats
path: root/apps/comments/lib/Activity/Provider.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/comments/lib/Activity/Provider.php')
-rw-r--r--apps/comments/lib/Activity/Provider.php70
1 files changed, 15 insertions, 55 deletions
diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php
index e42e119c617..715be29e2ed 100644
--- a/apps/comments/lib/Activity/Provider.php
+++ b/apps/comments/lib/Activity/Provider.php
@@ -37,34 +37,15 @@ use OCP\L10N\IFactory;
class Provider implements IProvider {
- /** @var IFactory */
- protected $languageFactory;
-
- /** @var IL10N */
- protected $l;
-
- /** @var IURLGenerator */
- protected $url;
-
- /** @var ICommentsManager */
- protected $commentsManager;
-
- /** @var IUserManager */
- protected $userManager;
-
- /** @var IManager */
- protected $activityManager;
-
+ protected IFactory $languageFactory;
+ protected ?IL10N $l = null;
+ protected IUrlGenerator $url;
+ protected ICommentsManager $commentsManager;
+ protected IUserManager $userManager;
+ protected IManager $activityManager;
/** @var string[] */
- protected $displayNames = [];
+ protected array $displayNames = [];
- /**
- * @param IFactory $languageFactory
- * @param IURLGenerator $url
- * @param ICommentsManager $commentsManager
- * @param IUserManager $userManager
- * @param IManager $activityManager
- */
public function __construct(IFactory $languageFactory, IURLGenerator $url, ICommentsManager $commentsManager, IUserManager $userManager, IManager $activityManager) {
$this->languageFactory = $languageFactory;
$this->url = $url;
@@ -111,11 +92,9 @@ class Provider implements IProvider {
}
/**
- * @param IEvent $event
- * @return IEvent
* @throws \InvalidArgumentException
*/
- protected function parseShortVersion(IEvent $event) {
+ protected function parseShortVersion(IEvent $event): IEvent {
$subjectParameters = $this->getSubjectParameters($event);
if ($event->getSubject() === 'add_comment_subject') {
@@ -137,11 +116,9 @@ class Provider implements IProvider {
}
/**
- * @param IEvent $event
- * @return IEvent
* @throws \InvalidArgumentException
*/
- protected function parseLongVersion(IEvent $event) {
+ protected function parseLongVersion(IEvent $event): IEvent {
$subjectParameters = $this->getSubjectParameters($event);
if ($event->getSubject() === 'add_comment_subject') {
@@ -170,7 +147,7 @@ class Provider implements IProvider {
return $event;
}
- protected function getSubjectParameters(IEvent $event) {
+ protected function getSubjectParameters(IEvent $event): array {
$subjectParameters = $event->getSubjectParameters();
if (isset($subjectParameters['fileId'])) {
return $subjectParameters;
@@ -190,10 +167,7 @@ class Provider implements IProvider {
];
}
- /**
- * @param IEvent $event
- */
- protected function parseMessage(IEvent $event) {
+ protected function parseMessage(IEvent $event): void {
$messageParameters = $event->getMessageParameters();
if (empty($messageParameters)) {
// Email
@@ -228,12 +202,7 @@ class Provider implements IProvider {
}
}
- /**
- * @param int $id
- * @param string $path
- * @return array
- */
- protected function generateFileParameter($id, $path) {
+ protected function generateFileParameter(int $id, string $path): array {
return [
'type' => 'file',
'id' => $id,
@@ -243,11 +212,7 @@ class Provider implements IProvider {
];
}
- /**
- * @param string $uid
- * @return array
- */
- protected function generateUserParameter($uid) {
+ protected function generateUserParameter(string $uid): array {
if (!isset($this->displayNames[$uid])) {
$this->displayNames[$uid] = $this->getDisplayName($uid);
}
@@ -259,16 +224,11 @@ class Provider implements IProvider {
];
}
- /**
- * @param string $uid
- * @return string
- */
- protected function getDisplayName($uid) {
+ protected function getDisplayName(string $uid): string {
$user = $this->userManager->get($uid);
if ($user instanceof IUser) {
return $user->getDisplayName();
- } else {
- return $uid;
}
+ return $uid;
}
}