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

InvalidBooleanException::forNonLiteralNode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 6
ccs 0
cts 5
cp 0
crap 2
rs 10
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