• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LibreSign / libresign / 19941551598

04 Dec 2025 07:35PM UTC coverage: 41.597%. First build
19941551598

Pull #6003

github

web-flow
Merge 100afcce3 into c0f07404c
Pull Request #6003: feat: footer template default detection

3 of 4 new or added lines in 2 files covered. (75.0%)

5193 of 12484 relevant lines covered (41.6%)

4.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.48
/lib/Service/FooterService.php
1
<?php
2

3
declare(strict_types=1);
4
/**
5
 * SPDX-FileCopyrightText: 2025 LibreCode coop and contributors
6
 * SPDX-License-Identifier: AGPL-3.0-or-later
7
 */
8

9
namespace OCA\Libresign\Service;
10

11
use OCA\Libresign\AppInfo\Application;
12
use OCA\Libresign\Handler\FooterHandler;
13
use OCP\IAppConfig;
14

15
class FooterService {
16
        public function __construct(
17
                private IAppConfig $appConfig,
18
                private FooterHandler $footerHandler,
19
        ) {
20
        }
20✔
21

22
        public function isDefaultTemplate(): bool {
23
                $customTemplate = $this->appConfig->getValueString(Application::APP_ID, 'footer_template', '');
3✔
24
                return empty($customTemplate);
3✔
25
        }
26

27
        public function getTemplate(): string {
28
                return $this->footerHandler->getTemplate();
2✔
29
        }
30

31
        public function saveTemplate(string $template = ''): void {
32
                if (empty($template)) {
6✔
33
                        $this->appConfig->deleteKey(Application::APP_ID, 'footer_template');
×
NEW
34
                        return;
×
35
                }
36

37
                if ($template === $this->footerHandler->getDefaultTemplate()) {
6✔
38
                        $this->appConfig->deleteKey(Application::APP_ID, 'footer_template');
1✔
39
                } else {
40
                        $this->appConfig->setValueString(Application::APP_ID, 'footer_template', $template);
5✔
41
                }
42
        }
43

44
        public function renderPreviewPdf(string $template = '', int $width = 595, int $height = 50): string {
45
                if (!empty($template)) {
8✔
46
                        $this->saveTemplate($template);
4✔
47
                }
48

49
                return $this->footerHandler
8✔
50
                        ->setTemplateVar('uuid', 'preview-' . bin2hex(random_bytes(8)))
8✔
51
                        ->setTemplateVar('signers', [
8✔
52
                                [
8✔
53
                                        'displayName' => 'Preview Signer',
8✔
54
                                        'signed' => date('c'),
8✔
55
                                ],
8✔
56
                        ])
8✔
57
                        ->getFooter([['w' => $width, 'h' => $height]]);
8✔
58
        }
59
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc