Passed
Push — main ( 553a30...c3cb08 )
by Martin
11:04 queued 10s
created

InvalidTimezoneException::forInvalidTimezone()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

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 5
cts 5
cp 1
crap 1
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 InvalidTimezoneException extends ConversionException
15
{
16
    public static function forNonLiteralNode(string $nodeClass, string $functionName): self
17
    {
18
        return new self(\sprintf(
19
            'The timezone parameter for %s must be a string literal, got %s',
20
            $functionName,
21
            $nodeClass
22
        ));
23
    }
24
25 2
    public static function forInvalidTimezone(string $timezone, string $functionName): self
26
    {
27 2
        return new self(\sprintf(
28 2
            'Invalid timezone "%s" provided for %s. Must be a valid PHP timezone identifier.',
29 2
            $timezone,
30 2
            $functionName
31 2
        ));
32
    }
33
}
34