Dictionary   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 6
c 2
b 1
f 0
dl 0
loc 18
ccs 2
cts 2
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validatedBy() 0 3 1
A getRequiredOptions() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Knp\DictionaryBundle\Validator\Constraints;
6
7
use Symfony\Component\Validator\Constraint;
8
9
/**
10
 * @Annotation
11
 * @Target({"PROPERTY", "METHOD"})
12
 */
13
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD)]
14
final class Dictionary extends Constraint
15
{
16
    public string $name;
17
18
    public string $message = "The key {{ key }} doesn't exist in the given dictionary. {{ keys }} available.";
19
20
    public function validatedBy(): string
21
    {
22
        return DictionaryValidator::class;
23
    }
24
25 1
    /**
26
     * @return array<string>
27 1
     */
28
    public function getRequiredOptions(): array
29
    {
30
        return ['name'];
31
    }
32
}
33