Passed
Push — main ( c3cb08...0cda90 )
by Martin
11:26
created

InvalidBooleanException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 45.45%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 17
ccs 5
cts 11
cp 0.4545
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A forInvalidBoolean() 0 6 1
A forNonLiteralNode() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception;
6
7
use Doctrine\DBAL\Types\ConversionException;
8
9
/**
10
 * @since 3.1
11
 *
12
 * @author Martin Georgiev <[email protected]>
13
 */
14
class InvalidBooleanException extends ConversionException
15
{
16
    public static function forNonLiteralNode(string $nodeClass, string $functionName): self
17
    {
18
        return new self(\sprintf(
19
            'The boolean parameter for %s must be a string literal, got %s',
20
            $functionName,
21
            $nodeClass
22
        ));
23
    }
24
25 5
    public static function forInvalidBoolean(string $value, string $functionName): self
26
    {
27 5
        return new self(\sprintf(
28 5
            'Invalid boolean value "%s" provided for %s. Must be "true" or "false".',
29 5
            $value,
30 5
            $functionName
31 5
        ));
32
    }
33
}
34