Passed
Push — master ( a43e58...4ea7aa )
by Giancarlos
08:09
created

PrepaymentValidator::loadValidatorMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 18
Ratio 100 %

Code Coverage

Tests 17
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 18
loc 18
ccs 17
cts 17
cp 1
rs 9.4285
cc 1
eloc 12
nc 1
nop 1
crap 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 View Code Duplication
trait PrepaymentValidator
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
{
20 12
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22 12
        $metadata->addPropertyConstraints('tipoDocRel', [
23 12
            new Assert\NotBlank(),
24 12
            new Assert\Length([
25 12
                'min' => 2,
26 12
                'max' => 2,
27 12
            ]),
28 12
        ]);
29 12
        $metadata->addPropertyConstraints('nroDocRel', [
30 12
            new Assert\NotBlank(),
31 12
            new Assert\Length([ 'max' => 30]),
32 12
        ]);
33 12
        $metadata->addPropertyConstraints('total',[
34 12
            new Assert\NotBlank(),
35 12
            new Assert\Type(['type' => 'numeric']),
36 12
        ]);
37
    }
38
}