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

ApiFactory   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 7
eloc 9
c 3
b 0
f 0
dl 0
loc 37
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A taskApi() 0 3 1
A projectApi() 0 3 1
A tagApi() 0 3 1
A clientApi() 0 3 1
A workspaceApi() 0 3 1
A userApi() 0 3 1
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