Passed
Push — feature/add-gacela-cli ( 2018fc )
by Chema
05:13 queued 15s
created

CommandArgumentsException::noAutoloadFound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\CodeGenerator\Domain\CommandArguments;
6
7
use RuntimeException;
8
9
final class CommandArgumentsException extends RuntimeException
10
{
11 1
    public static function noAutoloadFound(): self
12
    {
13 1
        return new self('No autoload found in your composer.json');
14
    }
15
16 1
    public static function noAutoloadPsr4Found(): self
17
    {
18 1
        return new self('No autoload psr-4 match found in your composer.json');
19
    }
20
21
    /**
22
     * @param list<string> $knownPsr4
23
     */
24 1
    public static function noAutoloadPsr4MatchFound(string $desiredNamespace, array $knownPsr4 = []): self
25
    {
26 1
        $parsedKnownPsr4 = array_map(static fn (string $p) => str_replace('\\', '', $p), $knownPsr4);
27
28 1
        return new self(
29 1
            sprintf(
30
                'No autoload psr-4 match found for %s. Known PSR-4: %s',
31
                $desiredNamespace,
32 1
                implode(', ', $parsedKnownPsr4)
33
            )
34
        );
35
    }
36
}
37