Completed
Push — master ( da1a6c...6bb072 )
by Marco
02:08
created

PackagesTrustCheckFailed   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 21
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
    public static function fromFailedPackageVerifications(
13
        PackageVerification $failedVerification,
14
        PackageVerification ...$furtherFailedVerifications
15
    ) : self {
16
        return new self(sprintf(
17
            'The following packages need to be signed and verified, or added to exclusions: %s%s',
18
            "\n",
19
            implode(
20
                "\n\n",
21
                array_map(
22
                    function (PackageVerification $failedVerification) : string {
23
                        return $failedVerification->printReason();
24
                    },
25
                    array_merge([$failedVerification], $furtherFailedVerifications)
26
                )
27
            )
28
        ));
29
    }
30
}
31