NotEnoughCalls   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromFunctionName() 0 15 1
1
<?php
2
declare(strict_types=1);
3
4
namespace idimsh\PhpInternalsMocker\Exception;
5
6
/**
7
 * @codeCoverageIgnore
8
 */
9
class NotEnoughCalls extends Exception
10
{
11
    public static function fromFunctionName(
12
        string $internalFunctionName,
13
        int $expectedInvocationCount,
14
        int $invocationCount
15
    ): self
16
    {
17
        $message = \sprintf(
18
            'Function [%s] was expected to be called %d times, actually called %d times. In:%s',
19
            $internalFunctionName,
20
            $expectedInvocationCount,
21
            $invocationCount,
22
            "\n" . self::getCustomTrace()
23
        );
24
25
        return new static($message);
26
    }
27
}
28