Completed
Pull Request — master (#5)
by Giancarlos
04:05
created

SummaryDetailV2Validator::loadValidatorMetadata()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 32
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 31
CRAP Score 1

Importance

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