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

PrepaymentValidator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

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