Passed
Push — master ( a7445e...7a8a1d )
by Jérémy
01:47
created

ApiFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A workspaceApi() 0 3 1
A __construct() 0 3 1
A tagApi() 0 3 1
A clientApi() 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\Tag\Tag,
10
    Api\Workspace\Workspace
11
};
12
13
class ApiFactory
14
{
15
    private $client;
16
17
    public function __construct(Client $client)
18
    {
19
        $this->client = $client;
20
    }
21
22
    public function clientApi(): ClientApi
23
    {
24
        return new ClientApi($this->client);
25
    }
26
27
    public function tagApi(): Tag
28
    {
29
        return new Tag($this->client);
30
    }
31
32
    public function workspaceApi(): Workspace
33
    {
34
        return new Workspace($this);
0 ignored issues
show
Bug introduced by
$this of type JDecool\Clockify\ApiFactory is incompatible with the type JDecool\Clockify\Client expected by parameter $http of JDecool\Clockify\Api\Wor...orkspace::__construct(). ( Ignorable by Annotation )

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

34
        return new Workspace(/** @scrutinizer ignore-type */ $this);
Loading history...
35
    }
36
}
37