Validator::validate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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