Completed
Push — master ( 544fde...527d7b )
by Giancarlos
02:31
created

LegendValidator::loadValidatorMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Giansalex
5
 * Date: 18/07/2017
6
 * Time: 23:40
7
 */
8
9
namespace Greenter\Xml\Validator;
10
11
use Symfony\Component\Validator\Mapping\ClassMetadata;
12
use Symfony\Component\Validator\Constraints as Assert;
13
14
/**
15
 * Trait LegendValidator
16
 * @package Greenter\Xml\Validator
17
 */
18
trait LegendValidator
19
{
20
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22
        $metadata->addPropertyConstraint('code', new Assert\Length([
23
            'min'=> 4,
24
            'max' => 4,
25
        ]));
26
        $metadata->addPropertyConstraint('value', new Assert\Length(['max' => 100]));
27
    }
28
}