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

SummaryDetailV2Validator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 35
ccs 31
cts 31
cp 1
rs 10
c 0
b 0
f 0

1 Method

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