Completed
Push — master ( 6ba45c...e1d569 )
by Giancarlos
04:03
created

PaymentValidator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 15
ccs 0
cts 12
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadValidatorMetadata() 0 12 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Administrador
5
 * Date: 08/08/2017
6
 * Time: 10:55 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
 * Trait PaymentValidator
16
 * @package Greenter\Xml\Validator
17
 */
18
trait PaymentValidator
19
{
20
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22
        $metadata->addPropertyConstraints('moneda', [
23
            new Assert\NotBlank(),
24
            new Assert\Length(['min' => 3, 'max' => 3]),
25
        ]);
26
        $metadata->addPropertyConstraint('importe', new Assert\NotBlank());
27
        $metadata->addPropertyConstraints('fecha', [
28
            new Assert\NotBlank(),
29
            new Assert\Date(),
30
        ]);
31
    }
32
}