Completed
Push — develop ( 0660be...71868c )
by Freddie
04:14
created

EqualToConstraintValidator::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
namespace FlexPHP\Schema\Validators\Constraints;
4
5
use Symfony\Component\Validator\Constraints\NotBlank;
6
use Symfony\Component\Validator\ConstraintViolationListInterface;
7
use Symfony\Component\Validator\Validation;
8
9
/**
10
 * @Annotation
11
 */
12
class EqualToConstraintValidator
13
{
14
    /**
15
     * @param mixed $string
16
     * @return ConstraintViolationListInterface
17
     */
18 2
    public function validate($string): ConstraintViolationListInterface
19
    {
20 2
        $validator = Validation::createValidator();
21
22 2
        return $validator->validate($string, [
23 2
            new NotBlank(),
24
        ]);
25
    }
26
}
27