Test Failed
Push — master ( 05d675...f4e7d7 )
by Giancarlos
04:02
created

SaleDetailValidator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 19
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadValidatorMetadata() 0 16 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Administrador
5
 * Date: 17/07/2017
6
 * Time: 10:38 AM
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
 * Class SaleDetailValidator
16
 * @package Greenter\Xml\Validator
17
 */
18
trait SaleDetailValidator
19
{
20
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22
        $metadata->addPropertyConstraints('codUnidadMedida', [
23
            new Assert\NotBlank(),
24
            new Assert\Length(['max' => 3]),
25
        ]);
26
        $metadata->addPropertyConstraints('desItem', [
27
            new Assert\NotBlank(),
28
            new Assert\Length(['max' => 250]),
29
        ]);
30
        $metadata->addPropertyConstraint('mtoValorUnitario', new Assert\NotBlank());
31
        $metadata->addPropertyConstraint('mtoIgvItem', new Assert\NotBlank());
32
        $metadata->addPropertyConstraint('tipAfeIgv', new Assert\NotBlank());
33
        $metadata->addPropertyConstraint('mtoPrecioUnitario', new Assert\NotBlank());
34
        $metadata->addPropertyConstraint('mtoValorVenta', new Assert\NotBlank());
35
    }
36
}