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

InvalidTimezoneException   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 forInvalidTimezone() 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 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