Favro::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 20
rs 9.4285
cc 1
eloc 15
nc 1
nop 2
1
<?php
2
3
namespace seregazhuk\Favro;
4
5
use GuzzleHttp\Client;
6
use seregazhuk\Favro\Api\Api;
7
use seregazhuk\Favro\Api\Endpoints\Cards;
8
use seregazhuk\Favro\Api\Endpoints\Collections;
9
use seregazhuk\Favro\Api\Endpoints\Columns;
10
use seregazhuk\Favro\Api\Endpoints\Comments;
11
use seregazhuk\Favro\Api\Endpoints\Organizations;
12
use seregazhuk\Favro\Api\Endpoints\Tags;
13
use seregazhuk\Favro\Api\Endpoints\TaskLists;
14
use seregazhuk\Favro\Api\Endpoints\Tasks;
15
use seregazhuk\Favro\Api\Endpoints\Users;
16
use seregazhuk\Favro\Api\Endpoints\Widgets;
17
18
class Favro
19
{
20
    /**
21
     * @param string $login
22
     * @param string $password
23
     * @return Api
24
     */
25
    public static function create($login, $password)
26
    {
27
        $httpClient = new GuzzleHttpClient(
28
            new Client(['auth' => [$login, $password]])
29
        );
30
31
        return new Api(
32
            $httpClient,
33
            new Cards($httpClient),
34
            new Collections($httpClient),
35
            new Columns($httpClient),
36
            new Comments($httpClient),
37
            new Organizations($httpClient),
38
            new Tags($httpClient),
39
            new TaskLists($httpClient),
40
            new Tasks($httpClient),
41
            new Users($httpClient),
42
            new Widgets($httpClient)
43
        );
44
    }
45
46
    /**
47
     * @codeCoverageIgnore
48
     */
49
    private function __construct()
50
    {
51
    }
52
53
    /**
54
     * @codeCoverageIgnore
55
     */
56
    private function __clone()
57
    {
58
    }
59
}
60