Passed
Push — master ( df80bc...5cc7cd )
by Jérémy
03:15 queued 01:22
created

ApiFactory::userApi()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JDecool\Clockify;
6
7
use JDecool\Clockify\{
8
    Api\Client\Client as ClientApi,
9
    Api\Project\Project,
10
    Api\Tag\Tag,
11
    Api\Task\Task,
12
    Api\User\User,
13
    Api\Workspace\Workspace
14
};
15
16
class ApiFactory
17
{
18
    private $client;
19
20
    public function __construct(Client $client)
21
    {
22
        $this->client = $client;
23
    }
24
25
    public function clientApi(): ClientApi
26
    {
27
        return new ClientApi($this->client);
28
    }
29
30
    public function projectApi(): Project
31
    {
32
        return new Project($this->client);
33
    }
34
35
    public function tagApi(): Tag
36
    {
37
        return new Tag($this->client);
38
    }
39
40
    public function taskApi(): Task
41
    {
42
        return new Task($this->client);
43
    }
44
45
    public function userApi(): User
46
    {
47
        return new User($this->client);
0 ignored issues
show
Bug introduced by
$this->client of type JDecool\Clockify\Client is incompatible with the type JDecool\Clockify\Api\Client\Client expected by parameter $http of JDecool\Clockify\Api\User\User::__construct(). ( Ignorable by Annotation )

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

47
        return new User(/** @scrutinizer ignore-type */ $this->client);
Loading history...
48
    }
49
50
    public function workspaceApi(): Workspace
51
    {
52
        return new Workspace($this->client);
53
    }
54
}
55