MethodToCall::getClassName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
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