Passed
Push — master ( c456fa...94124a )
by Gabriel
11:31
created

Validator::cif()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace ByTIC\Validator\Utility;
4
5
use ByTIC\Validator\Constraints\Cif;
6
use Symfony\Component\Validator\Validation;
7
8
/**
9
 * Class Validator
10
 * @package ByTIC\Validator\Utility
11
 */
12
class Validator
13
{
14
    public static function cif($value): \Symfony\Component\Validator\ConstraintViolationListInterface
15
    {
16
        return self::validate($value, new Cif());
17
    }
18
19
    /**
20
     * @param $value
21
     * @param $constraints
22
     * @return \Symfony\Component\Validator\ConstraintViolationListInterface
23
     */
24
    protected static function validate($value, $constraints)
25
    {
26
        $validator = Validation::createValidator();
27
        return $validator->validate(
28
            $value,
29
            $constraints
30
        );
31
    }
32
}
33