Completed
Push — master ( 4d6576...fc2ff1 )
by Giancarlos
04:17
created

SalePerceptionValidator::loadValidatorMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
ccs 12
cts 12
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 9
nc 1
nop 1
crap 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 22
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22 22
        $metadata->addPropertyConstraints('codReg', [
23 22
            new Assert\NotBlank(),
24 22
            new Assert\Length([
25 22
                'min' => 2,
26 22
                'max' => 2,
27 22
            ]),
28 22
        ]);
29 22
        $metadata->addPropertyConstraint('mtoBase', new Assert\NotBlank());
30 22
        $metadata->addPropertyConstraint('mto', new Assert\NotBlank());
31 22
        $metadata->addPropertyConstraint('mtoTotal', new Assert\NotBlank());
32
    }
33
}