Passed
Pull Request — master (#1691)
by Tarmo
12:26 queued 09:10
created

Timezone::getTargets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
/**
4
 * /src/Validator/Constraints/Timezone.php
5
 *
6
 * @author TLe, Tarmo Leppänen <[email protected]>
7
 */
8
9
namespace App\Validator\Constraints;
10
11
use Attribute;
12
use Symfony\Component\Validator\Constraint;
13
14
/**
15
 * Class Timezone
16
 *
17
 * Usage example;
18
 *  App\Validator\Constraints\Timezone()
19
 *
20
 * Just add that to your property as an annotation and you're good to go.
21
 *
22
 * @Annotation
23
 * @Target({"PROPERTY"})
24
 *
25
 * @package App\Validator\Constraints
26
 * @author TLe, Tarmo Leppänen <[email protected]>
27
 */
28
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
29
class Timezone extends Constraint
30
{
31
    public const INVALID_TIMEZONE = '1f8dd2a3-5b61-43ca-a6b2-af553f86ac17';
32
    public const MESSAGE = 'This timezone "{{ timezone }}" is not valid.';
33
34
    /**
35
     * {@inheritdoc}
36
     *
37
     * @var array<string, string>
38
     */
39
    protected static $errorNames = [
40
        self::INVALID_TIMEZONE => 'INVALID_TIMEZONE',
41
    ];
42
}
43