Total Complexity | 7 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Coverage | 91.67% |
Changes | 0 |
1 | <?php |
||
7 | final class Situations |
||
8 | { |
||
9 | public static $situations = []; |
||
10 | |||
11 | 110 | public static function add($situation): void |
|
14 | 110 | } |
|
15 | |||
16 | 106 | public static function call($method, $args) |
|
17 | { |
||
18 | 106 | $args = is_array($args[0]) ? $args[0] : $args; |
|
19 | 106 | foreach (self::$situations as $className) { |
|
20 | 106 | if (self::methodExists($method, $className)) { |
|
21 | 106 | resolve($className)->$method(...$args); |
|
22 | |||
23 | 105 | return resolve(YouShouldHave::class); |
|
24 | } |
||
25 | } |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param string $method |
||
30 | * @param string $className |
||
31 | * |
||
32 | * @return bool |
||
33 | */ |
||
34 | 106 | private static function methodExists(string $method, string $className): bool |
|
37 | } |
||
38 | } |
||
39 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.