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

LibreSign / libresign / 19941205528

04 Dec 2025 07:22PM UTC coverage: 41.587%. First build
19941205528

Pull #6000

github

web-flow
Merge e06db9341 into de01f7f95
Pull Request #6000: feat: footer service empty string handling

3 of 5 new or added lines in 2 files covered. (60.0%)

5190 of 12480 relevant lines covered (41.59%)

4.18 hits per line

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

94.44
/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
        }
19✔
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)) {
5✔
NEW
33
                        $this->appConfig->deleteKey(Application::APP_ID, 'footer_template');
×
34
                } else {
35
                        $this->appConfig->setValueString(Application::APP_ID, 'footer_template', $template);
5✔
36
                }
37
        }
38

39
        public function renderPreviewPdf(string $template = '', int $width = 595, int $height = 50): string {
40
                if (!empty($template)) {
8✔
41
                        $this->saveTemplate($template);
4✔
42
                }
43

44
                return $this->footerHandler
8✔
45
                        ->setTemplateVar('uuid', 'preview-' . bin2hex(random_bytes(8)))
8✔
46
                        ->setTemplateVar('signers', [
8✔
47
                                [
8✔
48
                                        'displayName' => 'Preview Signer',
8✔
49
                                        'signed' => date('c'),
8✔
50
                                ],
8✔
51
                        ])
8✔
52
                        ->getFooter([['w' => $width, 'h' => $height]]);
8✔
53
        }
54
}
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