EqualToConstraintValidator::validate()   A
last analyzed

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 declare(strict_types=1);
2
/*
3
 * This file is part of FlexPHP.
4
 *
5
 * (c) Freddie Gar <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace FlexPHP\Schema\Validators\Constraints;
11
12
use Symfony\Component\Validator\Constraints\NotBlank;
13
use Symfony\Component\Validator\ConstraintViolationListInterface;
14
use Symfony\Component\Validator\Validation;
15
16
/**
17
 * @Annotation
18
 */
19
class EqualToConstraintValidator
20
{
21
    /**
22
     * @param string $string
23
     */
24 7
    public function validate($string): ConstraintViolationListInterface
25
    {
26 7
        $validator = Validation::createValidator();
27
28 7
        return $validator->validate($string, [
29 7
            new NotBlank(),
30
        ]);
31
    }
32
}
33