Passed
Pull Request — master (#149)
by Pierre
03:06
created

Dictionary   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 23
ccs 4
cts 4
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
final class Dictionary extends Constraint
14
{
15
    /**
16
     * @var string
17
     */
18
    public $name;
19
20
    /**
21
     * @var string
22
     */
23
    public $message = "The key {{ key }} doesn't exist in the given dictionary. {{ keys }} available.";
24
25 1
    public function validatedBy()
26
    {
27 1
        return DictionaryValidator::class;
28
    }
29
30
    /**
31
     * @return string[]
32
     */
33 5
    public function getRequiredOptions()
34
    {
35 5
        return ['name'];
36
    }
37
}
38