MethodToCall   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 27
ccs 10
cts 10
cp 1
rs 10
c 2
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getClassName() 0 3 1
A __construct() 0 11 3
A getMethodName() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace League\Tactician\Handler\Mapping;
6
7
use function method_exists;
8
9
final class MethodToCall
10
{
11
    private string $className;
12
13
    private string $methodName;
14
15 4
    public function __construct(string $className, string $methodName)
16
    {
17
        // If the method does not actually exist, we'll also check if __call exists (mainly for
18
        // legacy purposes). That said, we won't rewrite the method name to __call because our
19
        // static analysis checker might still be able to infer data from the original method name.
20 4
        if (! method_exists($className, $methodName) && ! method_exists($className, '__call')) {
21 1
            throw MethodDoesNotExist::on($className, $methodName);
22
        }
23
24 3
        $this->className  = $className;
25 3
        $this->methodName = $methodName;
26 3
    }
27
28 3
    public function getClassName(): string
29
    {
30 3
        return $this->className;
31
    }
32
33 3
    public function getMethodName(): string
34
    {
35 3
        return $this->methodName;
36
    }
37
}
38