PackagesTrustCheckFailed   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 21
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromFailedPackageVerifications() 0 18 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Roave\ComposerGpgVerify\Exception;
6
7
use LogicException;
8
use Roave\ComposerGpgVerify\Package\PackageVerification;
9
10
class PackagesTrustCheckFailed extends LogicException
11
{
12 2
    public static function fromFailedPackageVerifications(
13
        PackageVerification $failedVerification,
14
        PackageVerification ...$furtherFailedVerifications
15
    ) : self {
16 2
        return new self(sprintf(
17 2
            'The following packages need to be signed and verified, or added to exclusions: %s%s',
18 2
            "\n",
19 2
            implode(
20 2
                "\n\n",
21 2
                array_map(
22 2
                    function (PackageVerification $failedVerification) : string {
23 2
                        return $failedVerification->printReason();
24 2
                    },
25 2
                    array_merge([$failedVerification], $furtherFailedVerifications)
26
                )
27
            )
28
        ));
29
    }
30
}
31