ApiObjectResponseFactory::add()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 4
crap 2
1
<?php
2
3
namespace PhpWinTools\WmiScripting\Testing\Responses;
4
5
use PhpWinTools\WmiScripting\Configuration\Config;
6
use PhpWinTools\WmiScripting\Testing\Support\VARIANTFake;
7
8
class ApiObjectResponseFactory
9
{
10
    public static function add($api_object, $method, $response, Config $config = null)
11
    {
12
        $config = $config ?? Config::testInstance();
13
14
        $config->addResolvable("{$api_object}.{$method}", $response);
15
    }
16
17 2
    public static function addVariantResponse($api_object, $method, $response, Config $config = null)
18
    {
19 2
        $config->addResolvable("{$api_object}.{$method}", VARIANTFake::withResponse($method, $response));
0 ignored issues
show
Bug introduced by
The method addResolvable() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
        $config->/** @scrutinizer ignore-call */ 
20
                 addResolvable("{$api_object}.{$method}", VARIANTFake::withResponse($method, $response));

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.

Loading history...
20 2
    }
21
}
22