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

LibreSign / libresign / 21293358735

23 Jan 2026 04:30PM UTC coverage: 45.267%. First build
21293358735

Pull #6548

github

web-flow
Merge 34dc69686 into 3b6e6d7e8
Pull Request #6548: fix: reduce N+1

33 of 68 new or added lines in 6 files covered. (48.53%)

7446 of 16449 relevant lines covered (45.27%)

4.93 hits per line

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

92.86
/lib/Service/SignerIndexProvider.php
1
<?php
2

3
declare(strict_types=1);
4
/**
5
 * SPDX-FileCopyrightText: 2020-2024 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\Db\SignRequest;
12

13
class SignerIndexProvider {
14
        public function __construct(
15
                private IdentifyMethodService $identifyMethodService,
16
        ) {
17
        }
2✔
18

19
        /**
20
         * @param SignRequest[] $signRequests
21
         * @return array<string, SignRequest[]>
22
         */
23
        public function build(array $signRequests): array {
24
                if (empty($signRequests)) {
1✔
NEW
25
                        return [];
×
26
                }
27
                $signRequestIds = array_column(array_map(fn ($sr) => ['id' => $sr->getId()], $signRequests), 'id');
1✔
28
                $identifyMethodsBatch = $this->identifyMethodService->getIdentifyMethodsFromSignRequestIds($signRequestIds);
1✔
29

30
                $index = [];
1✔
31
                foreach ($signRequests as $signRequest) {
1✔
32
                        $identifyMethods = $identifyMethodsBatch[$signRequest->getId()] ?? [];
1✔
33
                        foreach ($identifyMethods as $methodInstances) {
1✔
34
                                foreach ($methodInstances as $identifyMethod) {
1✔
35
                                        $entity = $identifyMethod->getEntity();
1✔
36
                                        $indexKey = $entity->getIdentifierKey() . ':' . $entity->getIdentifierValue();
1✔
37
                                        $index[$indexKey][] = $signRequest;
1✔
38
                                }
39
                        }
40
                }
41
                return $index;
1✔
42
        }
43
}
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