libresign/lib/Activity/Settings/FileSigned.php
Vitor Mattos 034ff9ecbb
fix: psalm issues about override
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-10-07 18:23:41 -03:00

81 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 LibreCode coop and contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Libresign\Activity\Settings;
use OCA\Libresign\Events\SignedEvent;
use OCA\Libresign\Exception\LibresignException;
use OCA\Libresign\Helper\ValidateHelper;
use OCP\IL10N;
use OCP\IUser;
use OCP\IUserSession;
class FileSigned extends LibresignActivitySettings {
public function __construct(
protected IL10N $l,
protected ValidateHelper $validateHelper,
protected IUserSession $userSession,
) {
}
/**
* {@inheritdoc}
*/
#[\Override]
public function getIdentifier(): string {
return SignedEvent::FILE_SIGNED;
}
/**
* {@inheritdoc}
*/
#[\Override]
public function getName(): string {
return $this->l->t('A document has been <strong>signed</strong>');
}
/**
* {@inheritdoc}
*/
#[\Override]
public function getPriority(): int {
return 52;
}
/**
* {@inheritdoc}
*/
#[\Override]
public function canChangeNotification(): bool {
if (!$this->userSession->getUser() instanceof IUser) {
return true;
}
try {
$this->validateHelper->canrequestSign($this->userSession->getUser());
} catch (LibresignException) {
return false;
}
return true;
}
/**
* {@inheritdoc}
*/
#[\Override]
public function canChangeMail() {
if (!$this->userSession->getUser() instanceof IUser) {
return true;
}
try {
$this->validateHelper->canrequestSign($this->userSession->getUser());
} catch (LibresignException) {
return false;
}
return true;
}
}