Completed
Push — master ( 544fde...527d7b )
by Giancarlos
02:31
created

NoteValidator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 67
ccs 0
cts 64
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadValidatorMetadata() 0 64 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Giansalex
5
 * Date: 18/07/2017
6
 * Time: 22:27
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 NoteValidator
16
 * @package Greenter\Xml\Validator
17
 */
18
trait NoteValidator
19
{
20
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22
        $metadata->addPropertyConstraints('tipoDoc', [
23
            new Assert\NotBlank(),
24
            new Assert\Length([
25
                'min' => 2,
26
                'max' => 2,
27
            ]),
28
        ]);
29
        $metadata->addPropertyConstraints('serie', [
30
            new Assert\NotBlank(),
31
            new Assert\Length([ 'max' => 4]),
32
        ]);
33
        $metadata->addPropertyConstraints('correlativo', [
34
            new Assert\NotBlank(),
35
            new Assert\Length(['max' => 8]),
36
        ]);
37
        $metadata->addPropertyConstraint('fechaEmision', new Assert\Date());
38
        $metadata->addPropertyConstraints('tipoDocUsuario', [
39
            new Assert\NotBlank(),
40
            new Assert\Length(['max' => 1]),
41
        ]);
42
        $metadata->addPropertyConstraints('numDocUsuario', [
43
            new Assert\NotBlank(),
44
            new Assert\Length(['max' => 15]),
45
        ]);
46
        $metadata->addPropertyConstraints('rznSocialUsuario', [
47
            new Assert\NotBlank(),
48
            new Assert\Length(['max' => 100]),
49
        ]);
50
        $metadata->addPropertyConstraints('tipoMoneda', [
51
            new Assert\NotBlank(),
52
            new Assert\Length(['max' => 3]),
53
        ]);
54
        $metadata->addPropertyConstraint('mtoOperGravadas', new Assert\NotBlank());
55
        $metadata->addPropertyConstraint('mtoOperInafectas', new Assert\NotBlank());
56
        $metadata->addPropertyConstraint('mtoOperExoneradas', new Assert\NotBlank());
57
        $metadata->addPropertyConstraint('mtoImpVenta', new Assert\NotBlank());
58
        $metadata->addPropertyConstraint('details', new Assert\Valid());
59
        $metadata->addPropertyConstraint('legends', new Assert\Valid());
60
        $metadata->addPropertyConstraint('relDocs', new Assert\Valid());
61
        $metadata->addPropertyConstraints('codMotivo', [
62
            new Assert\NotBlank(),
63
            new Assert\Length([
64
                'min' => 2,
65
                'max' => 2,
66
            ]),
67
        ]);
68
        $metadata->addPropertyConstraints('desMotivo', [
69
            new Assert\NotBlank(),
70
            new Assert\Length([ 'max' => 250]),
71
        ]);
72
        $metadata->addPropertyConstraints('tipDocAfectado', [
73
            new Assert\NotBlank(),
74
            new Assert\Length([
75
                'min' => 2,
76
                'max' => 2,
77
            ]),
78
        ]);
79
        $metadata->addPropertyConstraints('numDocfectado', [
80
            new Assert\NotBlank(),
81
            new Assert\Length([ 'max' => 13]),
82
        ]);
83
    }
84
}