Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
ImagickSetupCheck
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
4 / 4
5
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCategory
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 run
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
2
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\SetupCheck;
10
11use OCP\IL10N;
12use OCP\SetupCheck\ISetupCheck;
13use OCP\SetupCheck\SetupResult;
14
15class ImagickSetupCheck implements ISetupCheck {
16    private IL10N $l10n;
17
18    public function __construct(IL10N $l10n) {
19        $this->l10n = $l10n;
20    }
21
22    #[\Override]
23    public function getName(): string {
24        // TRANSLATORS Name of the Nextcloud administration overview check for the Imagick library used to render visible signatures.
25        return $this->l10n->t('Imagick PHP extension');
26    }
27
28    #[\Override]
29    public function getCategory(): string {
30        return 'system';
31    }
32
33    #[\Override]
34    public function run(): SetupResult {
35        if (!extension_loaded('imagick')) {
36            return SetupResult::info(
37                // TRANSLATORS Warning shown in Nextcloud administration overview when the Imagick library is not available.
38                $this->l10n->t('Imagick extension is not loaded'),
39                // TRANSLATORS Tip under a Nextcloud administration overview warning. Explains installing Imagick to enable visible signatures and related image rendering.
40                $this->l10n->t('Install php-imagick to enable visible signatures, background images, and signature element rendering.')
41            );
42        }
43        // TRANSLATORS Success message in Nextcloud administration overview when the Imagick library is available.
44        return SetupResult::success($this->l10n->t('Imagick extension is loaded'));
45    }
46}