Failed Conditions
Pull Request — new-parser-ast-metadata (#3)
by
unknown
06:33 queued 04:54
created

InvalidValue   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 6
dl 0
loc 14
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A new() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Assembler\Validator\Constraint\Exception;
6
7
use function gettype;
8
use function implode;
9
use function sprintf;
10
11
final class InvalidValue extends ConstraintNotFulfilled
12
{
13
    /**
14
     * @param mixed[] $allowedValues
15
     * @param mixed   $value
16
     */
17 1
    public static function new(array $allowedValues, $value) : self
18
    {
19
        // TODO: Describe values
20 1
        return new self(
21 1
            sprintf(
22 1
                'Invalid value "%s" for allowed values: "%s".',
23 1
                gettype($value),
24 1
                implode(',', $allowedValues)
25
            )
26
        );
27
    }
28
}
29