Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
JSignPdfRelease
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
5 / 5
5
100.00% covered (success)
100.00%
1 / 1
 archiveName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 downloadUrl
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 checksumUrl
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 installPath
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 releaseUrl
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4/**
5 * SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
6 * SPDX-License-Identifier: AGPL-3.0-or-later
7 */
8
9namespace OCA\Libresign\Service\Install;
10
11/**
12 * Where LibreSign downloads JSignPdf from and where the archive ends up once
13 * extracted.
14 *
15 * JSignPdf 3.1 dropped the single JSignPdf.jar. The "minimal" package, meant
16 * for headless and command line use, ships a lib/ directory that the PHP
17 * wrapper starts through the classpath, so the configured path is the
18 * extracted directory instead of a jar file.
19 */
20final class JSignPdfRelease {
21    public const VERSION = '3.1.0';
22    private const RELEASES_URL = 'https://github.com/intoolswetrust/jsignpdf/releases/download/';
23
24    public static function archiveName(): string {
25        return 'jsignpdf-' . self::VERSION . '-minimal.zip';
26    }
27
28    public static function downloadUrl(): string {
29        return self::releaseUrl() . self::archiveName();
30    }
31
32    /**
33     * One line per asset of the release, in the "hash  file name" format.
34     */
35    public static function checksumUrl(): string {
36        return self::releaseUrl() . 'jsignpdf-' . self::VERSION . '-SHA256SUMS.txt';
37    }
38
39    /**
40     * The archive extracts to a directory named after the version.
41     */
42    public static function installPath(string $extractDir): string {
43        return $extractDir . '/jsignpdf-' . self::VERSION;
44    }
45
46    private static function releaseUrl(): string {
47        return self::RELEASES_URL . 'JSignPdf_' . str_replace('.', '_', self::VERSION) . '/';
48    }
49}