Completed
Push — master ( 527d7b...b463b0 )
by Giancarlos
07:13
created

LegendValidator::loadValidatorMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 1
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 10
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22 10
        $metadata->addPropertyConstraint('code', new Assert\Length([
23 10
            'min'=> 4,
24 10
            'max' => 4,
25 10
        ]));
26 10
        $metadata->addPropertyConstraint('value', new Assert\Length(['max' => 100]));
27
    }
28
}