NeverExpected::fromFunctionName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace idimsh\PhpInternalsMocker\Exception;
5
6
/**
7
 * @codeCoverageIgnore
8
 */
9
class NeverExpected extends Exception
10
{
11
    public static function fromFunctionName(string $internalFunctionName): self
12
    {
13
        $message = \sprintf(
14
            'Function %s was never expected to be called. In:%s',
15
            $internalFunctionName,
16
            "\n" . self::getCustomTrace()
17
        );
18
        return new static($message);
19
    }
20
}
21