MissingSignatureException::fromMissingSignature()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManager\Signature\Exception;
6
7
use ReflectionClass;
8
use UnexpectedValueException;
9
use function count;
10
use function sprintf;
11
12
/**
13
 * Exception for no found signatures
14
 */
15
class MissingSignatureException extends UnexpectedValueException implements ExceptionInterface
16
{
17
    /** @param mixed[] $parameters */
18
    public static function fromMissingSignature(ReflectionClass $class, array $parameters, string $expected) : self
19 1
    {
20
        return new self(sprintf(
21 1
            'No signature found for class "%s", expected signature "%s" for %d parameters',
22 1
            $class->getName(),
23 1
            $expected,
24 1
            count($parameters)
25 1
        ));
26
    }
27
}
28