Passed
Push — master ( b16a12...abed16 )
by Ax
09:12
created

Api::__construct()   A

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
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace SchoppAx\Sleeper\Api;
4
5
use SchoppAx\Sleeper\Http\Client;
6
7
abstract class Api implements ApiInterface
8
{
9
    private Client $client;
10
11 1
    public function __construct(Client $client)
12
    {
13 1
      $this->client = $client;
14 1
    }
15
16
17
    /**
18
     * @param string $path
19
     * @return json of called api resource
0 ignored issues
show
Bug introduced by
The type SchoppAx\Sleeper\Api\json was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
     * @throws SleeperException
21
     */
22 1
    public function get(string $path)
23
    {
24 1
      $response = $this->client->request('GET', $path);
25
26 1
      if ($response->getStatusCode() !== 200) {
27
        throw new SleeperHttpException($response->getStatusCode());
28 1
      } elseif ($response->getBody() === 'null') {
0 ignored issues
show
introduced by
The condition $response->getBody() === 'null' is always false.
Loading history...
29
        throw new NullPointerException('The $var does not exist');
0 ignored issues
show
Bug introduced by
The type SchoppAx\Sleeper\Api\NullPointerException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
30
      }
31
32 1
      return json_decode($response->getBody(), true);
33
    }
34
35
}
36