Completed
Push — master ( 4d6576...fc2ff1 )
by Giancarlos
04:17
created

DetractionValidator::loadValidatorMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 8
ccs 7
cts 7
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Administrador
5
 * Date: 28/09/2017
6
 * Time: 10:09 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 DetractionValidator
16
 * @package Greenter\Xml\Validator
17
 */
18
trait DetractionValidator
19
{
20 12
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22 12
        $metadata->addPropertyConstraints('percent', [
23 12
            new Assert\NotBlank(),
24 12
            new Assert\Type(['type' => 'numeric']),
25 12
        ]);
26 12
        $metadata->addPropertyConstraint('mount', new Assert\NotBlank());
27
    }
28
}