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

PreferredInstallIsNotSource   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromPreferredInstall() 0 11 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
    public static function fromPreferredInstall($preferredInstall) : self
17
    {
18
        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
            . 'https://getcomposer.org/doc/06-config.md#preferred-install',
24
            json_encode($preferredInstall)
25
        ));
26
    }
27
}
28