TelegramApiLogicException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 7
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A becauseOfWrongType() 0 5 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zored\Telegram\Exception;
6
7
use function get_class;
8
use function gettype;
9
use function is_object;
10
11
class TelegramApiLogicException extends \LogicException
12
{
13
    public static function becauseOfWrongType($object, string $expected): self
14
    {
15
        $actual = is_object($object) ? get_class($object) : gettype($object);
16
17
        return new self("Expected '$expected', got: '$actual'.");
18
    }
19
}
20