unsupportedCombination()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 3
dl 0
loc 7
ccs 0
cts 6
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception;
6
7
class InvalidArgumentForVariadicFunctionException extends \InvalidArgumentException
8
{
9
    public static function exactCount(string $functionName, int $expected): self
10
    {
11
        return new self(\sprintf(
12
            '%s() requires exactly %d argument%s',
13
            $functionName,
14
            $expected,
15
            $expected === 1 ? '' : 's'
16
        ));
17
    }
18
19 44
    public static function atLeast(string $functionName, int $min): self
20
    {
21 44
        return new self(\sprintf(
22 44
            '%s() requires at least %d argument%s',
23 44
            $functionName,
24 44
            $min,
25 44
            $min === 1 ? '' : 's'
26 44
        ));
27
    }
28
29 47
    public static function between(string $functionName, int $min, int $max): self
30
    {
31 47
        return new self(\sprintf(
32 47
            '%s() requires between %d and %d arguments',
33 47
            $functionName,
34 47
            $min,
35 47
            $max
36 47
        ));
37
    }
38
39 2
    public static function evenNumber(string $functionName): self
40
    {
41 2
        return new self(\sprintf(
42 2
            '%s() requires an even number of arguments',
43 2
            $functionName
44 2
        ));
45
    }
46
47
    public static function unsupportedCombination(string $functionName, int $count, string $note): self
48
    {
49
        return new self(\sprintf(
50
            '%s() cannot be called with %d arguments, because %s',
51
            $functionName,
52
            $count,
53
            $note,
54
        ));
55
    }
56
}
57