CallsLimitExceeded   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromFunctionNameLimit() 0 11 2
1
<?php
2
declare(strict_types=1);
3
4
namespace idimsh\PhpInternalsMocker\Exception;
5
6
/**
7
 * @codeCoverageIgnore
8
 */
9
class CallsLimitExceeded extends Exception
10
{
11
    public static function fromFunctionNameLimit(string $internalFunctionName, int $limit): self
12
    {
13
        $message = \sprintf(
14
            'Function %s is not expected to be called more than %d %s. In:%s',
15
            $internalFunctionName,
16
            $limit,
17
            $limit > 1 ? 'times' : 'time',
18
            "\n" . self::getCustomTrace()
19
        );
20
21
        return new static($message);
22
    }
23
}
24