Test Failed
Push — master ( a47c2b...4d6576 )
by Giancarlos
04:07
created

SalePerceptionValidator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 16
ccs 0
cts 12
cp 0
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadValidatorMetadata() 0 13 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Giansalex
5
 * Date: 30/07/2017
6
 * Time: 15:37
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 SalePerceptionValidator
16
 * @package Greenter\Xml\Validator
17
 */
18
trait SalePerceptionValidator
19
{
20
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22
        $metadata->addPropertyConstraints('codReg', [
23
            new Assert\NotBlank(),
24
            new Assert\Length([
25
                'min' => 2,
26
                'max' => 2,
27
            ]),
28
        ]);
29
        $metadata->addPropertyConstraint('mtoBase', new Assert\NotBlank());
30
        $metadata->addPropertyConstraint('mto', new Assert\NotBlank());
31
        $metadata->addPropertyConstraint('mtoTotal', new Assert\NotBlank());
32
    }
33
}