fromPreferredInstall()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 11
ccs 4
cts 4
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 8
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Roave\ComposerGpgVerify\Exception;
6
7
use InvalidArgumentException;
8
9
class PreferredInstallIsNotSource extends InvalidArgumentException
10
{
11
    /**
12
     * @param string|array $preferredInstall
13
     *
14
     * @return self
15
     */
16 2
    public static function fromPreferredInstall($preferredInstall) : self
17
    {
18 2
        return new self(sprintf(
19
            'The detected preferred install required for the git verification to work correctly is "source", '
20
            . 'but your composer.json configuration reported %s.'
21
            . "\n"
22
            . 'Please edit your composer.json to enforce "source" installation as described at '
23 2
            . 'https://getcomposer.org/doc/06-config.md#preferred-install',
24 2
            json_encode($preferredInstall)
25
        ));
26
    }
27
}
28