Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| SignedCallbackListener | |
0.00% |
0 / 6 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| handle | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
20 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | /** |
| 5 | * SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors |
| 6 | * SPDX-License-Identifier: AGPL-3.0-or-later |
| 7 | */ |
| 8 | |
| 9 | namespace OCA\Libresign\Listener; |
| 10 | |
| 11 | use OCA\Libresign\Events\SignedEvent; |
| 12 | use OCA\Libresign\Service\SignFileService; |
| 13 | use OCP\EventDispatcher\Event; |
| 14 | use OCP\EventDispatcher\IEventListener; |
| 15 | |
| 16 | /** @template-implements IEventListener<SignedEvent> */ |
| 17 | class SignedCallbackListener implements IEventListener { |
| 18 | public function __construct( |
| 19 | private SignFileService $signFileService, |
| 20 | ) { |
| 21 | } |
| 22 | |
| 23 | #[\Override] |
| 24 | public function handle(Event $event): void { |
| 25 | /** @var SignedEvent */ |
| 26 | if (!($event instanceof SignedEvent)) { |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | $updatedFields = $event->getLibreSignFile()->getUpdatedFields(); |
| 31 | if (isset($updatedFields['signed']) && $updatedFields['signed'] === true) { |
| 32 | $this->signFileService->notifyCallback($event->getSignedFile()); |
| 33 | } |
| 34 | } |
| 35 | } |