Completed
Push — master ( 544fde...527d7b )
by Giancarlos
02:31
created

SummaryDetailValidator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadValidatorMetadata() 22 22 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Giansalex
5
 * Date: 18/07/2017
6
 * Time: 21:22
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 SummaryDetailValidator
16
 * @package Greenter\Xml\Validator
17
 */
18 View Code Duplication
trait SummaryDetailValidator
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
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22
        $metadata->addPropertyConstraints('tipoDoc', [
23
            new Assert\NotBlank(),
24
            new Assert\Length([
25
                'min' => 2,
26
                'max' => 2,
27
            ]),
28
        ]);
29
        $metadata->addPropertyConstraints('serie', [
30
            new Assert\NotBlank(),
31
            new Assert\Length([ 'max' => 4]),
32
        ]);
33
        $metadata->addPropertyConstraints('correlativo', [
34
            new Assert\NotBlank(),
35
            new Assert\Length(['max' => 8]),
36
        ]);
37
        $metadata->addPropertyConstraints('desMotivoBaja', [
38
            new Assert\NotBlank(),
39
            new Assert\Length(['max' => 100]),
40
        ]);
41
    }
42
}