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

LegendValidator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 11
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadValidatorMetadata() 0 8 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
    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
}