Test Failed
Push — master ( 3039cd...fafff9 )
by Giancarlos
02:43
created

PrepaymentValidator::loadValidatorMetadata()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 18
nc 1
nop 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Administrador
5
 * Date: 27/09/2017
6
 * Time: 08:31 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 PrepaymentValidator
16
 * @package Greenter\Xml\Validator
17
 */
18
trait PrepaymentValidator
19
{
20
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22
        $metadata->addPropertyConstraints('tipoDocRel', [
23
            new Assert\NotBlank(),
24
            new Assert\Length([
25
                'min' => 2,
26
                'max' => 2,
27
            ]),
28
        ]);
29
        $metadata->addPropertyConstraints('nroDocRel', [
30
            new Assert\NotBlank(),
31
            new Assert\Length([ 'max' => 30]),
32
        ]);
33
        $metadata->addPropertyConstraints('total',[
34
            new Assert\NotBlank(),
35
            new Assert\Type(['type' => 'numeric']),
36
        ]);
37
        $metadata->addPropertyConstraints('tipoDocEmisor', [
38
            new Assert\NotBlank(),
39
            new Assert\Length(['max' => 1]),
40
        ]);
41
        $metadata->addPropertyConstraints('nroDocEmisor',[
42
            new Assert\NotBlank(),
43
            new Assert\Length(['max' => 15]),
44
        ]);
45
    }
46
}