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

SummaryDetailValidator::loadValidatorMetadata()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 29
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 31
ccs 29
cts 29
cp 1
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 22
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Giansalex
5
 * Date: 18/07/2017
6
 * Time: 21:22
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 SummaryDetailValidator
16
 * @package Greenter\Xml\Validator
17
 */
18
trait SummaryDetailValidator
19
{
20 4
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22 4
        $metadata->addPropertyConstraints('tipoDoc', [
23 4
            new Assert\NotBlank(),
24 4
            new Assert\Length([
25 4
                'min' => 2,
26 4
                'max' => 2,
27 4
            ]),
28 4
        ]);
29 4
        $metadata->addPropertyConstraints('serie', [
30 4
            new Assert\NotBlank(),
31 4
            new Assert\Length([
32 4
                'min' => 4,
33 4
                'max' => 4,
34 4
            ]),
35 4
        ]);
36 4
        $metadata->addPropertyConstraints('docInicio', [
37 4
            new Assert\NotBlank(),
38 4
            new Assert\Length(['max' => 8]),
39 4
        ]);
40 4
        $metadata->addPropertyConstraints('docFin', [
41 4
            new Assert\NotBlank(),
42 4
            new Assert\Length(['max' => 8]),
43 4
        ]);
44 4
        $metadata->addPropertyConstraint('total', new Assert\NotBlank());
45 4
        $metadata->addPropertyConstraint('mtoOperGravadas', new Assert\NotBlank());
46 4
        $metadata->addPropertyConstraint('mtoOperInafectas', new Assert\NotBlank());
47 4
        $metadata->addPropertyConstraint('mtoOperExoneradas', new Assert\NotBlank());
48 4
        $metadata->addPropertyConstraint('mtoIGV', new Assert\NotBlank());
49
50
    }
51
}