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

LibreSign / libresign / 3717593689

pending completion
3717593689

Pull #1287

github

GitHub
Merge 42fe701e4 into ff8c1edaf
Pull Request #1287: [stable25] Bump packages

2548 of 4384 relevant lines covered (58.12%)

4.74 hits per line

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

0.0
/lib/Command/Configure/Check.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace OCA\Libresign\Command\Configure;
6

7
use OC\Core\Command\Base;
8
use OCA\Libresign\Service\ConfigureCheckService;
9
use Symfony\Component\Console\Helper\Table;
10
use Symfony\Component\Console\Helper\TableCell;
11
use Symfony\Component\Console\Helper\TableCellStyle;
12
use Symfony\Component\Console\Input\InputInterface;
13
use Symfony\Component\Console\Input\InputOption;
14
use Symfony\Component\Console\Output\OutputInterface;
15

16
class Check extends Base {
17
        private ConfigureCheckService $configureCheckService;
18
        public function __construct(
19
                ConfigureCheckService $configureCheckService
20
        ) {
21
                parent::__construct();
×
22
                $this->configureCheckService = $configureCheckService;
×
23
        }
24

25
        protected function configure(): void {
26
                $this
×
27
                        ->setName('libresign:configure:check')
×
28
                        ->setDescription('Check configure')
×
29
                        ->addOption('preview',
×
30
                                'p',
×
31
                                InputOption::VALUE_NONE,
×
32
                                'Check requirements to generate image preview'
×
33
                        )
×
34
                        ->addOption('sign',
×
35
                                's',
×
36
                                InputOption::VALUE_NONE,
×
37
                                'Check requirements to sign document'
×
38
                        )
×
39
                        ->addOption('cfssl',
×
40
                                'c',
×
41
                                InputOption::VALUE_NONE,
×
42
                                'Check requirements to use CFSSL API'
×
43
                        );
×
44
        }
45

46
        protected function execute(InputInterface $input, OutputInterface $output): int {
47
                $preview = $input->getOption('preview');
×
48
                $sign = $input->getOption('sign');
×
49
                $cfssl = $input->getOption('cfssl');
×
50
                $all = (!$preview && !$sign && !$cfssl);
×
51

52
                $result = [];
×
53
                if ($all) {
×
54
                        $result = $this->configureCheckService->checkAll();
×
55
                } else {
56
                        if ($preview) {
×
57
                                $result = array_merge($result, $this->configureCheckService->canPreview());
×
58
                        }
59
                        if ($sign) {
×
60
                                $result = array_merge($result, $this->configureCheckService->checkSign());
×
61
                        }
62
                        if ($cfssl) {
×
63
                                $result = array_merge($result, $this->configureCheckService->checkCfssl());
×
64
                        }
65
                }
66

67
                if (count($result)) {
×
68
                        $table = new Table($output);
×
69
                        foreach ($result as $row) {
×
70
                                $table->addRow([
×
71
                                        new TableCell($row->getStatus(), ['style' => new TableCellStyle([
×
72
                                                'bg' => $row->getStatus() === 'success' ? 'green' : 'red',
×
73
                                                'align' => 'center',
×
74
                                        ])]),
×
75
                                        $row->getResource(),
×
76
                                        $row->getMessage(),
×
77
                                        $row->getTip(),
×
78
                                ]);
×
79
                        }
80
                        $table
×
81
                                ->setHeaders([
×
82
                                        'Status',
×
83
                                        'Resource',
×
84
                                        'Message',
×
85
                                        'Tip',
×
86
                                ])
×
87
                                ->setStyle('symfony-style-guide')
×
88
                                ->render();
×
89
                }
90
                return 0;
×
91
        }
92
}
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

© 2025 Coveralls, Inc