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

EqualToConstraintValidator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 12
ccs 4
cts 4
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 6 1
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