IproSoftware::__call()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
ccs 0
cts 5
cp 0
crap 6
1
<?php
2
3
namespace LaravelIproSoftwareApi;
4
5
use Illuminate\Support\Facades\Config;
6
use IproSoftwareApi\IproSoftwareClient;
7
use Psr\Http\Message\ResponseInterface;
8
9
class IproSoftware extends IproSoftwareClient
10
{
11
    /**
12
     * IproSoftware constructor.
13
     * @throws \IproSoftwareApi\Exceptions\IproSoftwareApiException
14
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
15
     */
16 1
    public function __construct()
17
    {
18 1
        parent::__construct([
19 1
            'api_host'             => Config::get('iprosoftware-api.api_host'),
20 1
            'client_id'            => Config::get('iprosoftware-api.client_id'),
21 1
            'client_secret'        => Config::get('iprosoftware-api.client_secret'),
22 1
            'oauth_endpoint'       => Config::get('iprosoftware-api.api_oauth_endpoint'),
23 1
            'requests_path_prefix' => Config::get('iprosoftware-api.requests_path_prefix'),
24 1
            'access_token_class'   => Config::get('iprosoftware-api.access_token_class'),
25 1
            'cache_manager'        => app(Config::get('iprosoftware-api.access_token_cacher')),
26 1
            'client_conf'          => Config::get('iprosoftware-api.default_client_conf'),
27 1
        ]);
28
    }
29
30
    public function __call($method, $parameters)
31
    {
32
        $response = parent::__call($method, $parameters);
33
        if ($response instanceof ResponseInterface) {
34
            $response = new IproApiResponse($response);
35
        }
36
37
        return $response;
38
    }
39
}
40