Issues (16)

src/Client.php (3 issues)

1
<?php
2
3
namespace Stevenmaguire\Services\Trello;
4
5
use GuzzleHttp\ClientInterface as HttpClient;
6
7
class Client
8
{
9
    use Traits\ApiMethodsTrait;
10
    use Traits\AuthorizationTrait;
11
    use Traits\BatchTrait;
12
    use Traits\ConfigurationTrait;
13
    use Traits\SearchTrait;
14
15
    /**
16
     * Default client options
17
     *
18
     * @var array
19
     */
20
    protected static $defaultOptions = [
21
        'domain' => 'https://trello.com',
22
        'key' => null,
23
        'proxy' => null,
24
        'version' => '1',
25
        'secret' => null,
26
    ];
27
28
    /**
29
     * Http broker
30
     *
31
     * @var Http
32
     */
33
    protected $http;
34
35
    /**
36
     * Creates new trello client.
37
     *
38 702
     * @param array $options
39
     */
40 702
    public function __construct($options = [])
41
    {
42 702
        Configuration::setMany($options, static::$defaultOptions);
43 702
44
        $this->http = new Http();
45
    }
46
47
    /**
48
     * Retrieves a new authorization broker.
49
     *
50 2
     * @return Stevenmaguire\Services\Trello\Authorization
0 ignored issues
show
The type Stevenmaguire\Services\T...es\Trello\Authorization was not found. Did you mean Stevenmaguire\Services\Trello\Authorization? If so, make sure to prefix the type with \.
Loading history...
51
     */
52 2
    public function getAuthorization()
53
    {
54
        return new Authorization();
55
    }
56
57
    /**
58
     * Retrieves currently configured http broker.
59
     *
60 684
     * @return Stevenmaguire\Services\Trello\Http
0 ignored issues
show
The type Stevenmaguire\Services\T...re\Services\Trello\Http was not found. Did you mean Stevenmaguire\Services\Trello\Http? If so, make sure to prefix the type with \.
Loading history...
61
     */
62 684
    public function getHttp()
63
    {
64
        return $this->http;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->http returns the type Stevenmaguire\Services\Trello\Http which is incompatible with the documented return type Stevenmaguire\Services\T...re\Services\Trello\Http.
Loading history...
65
    }
66
67
    /**
68
     * Updates the http client used by http broker.
69
     *
70
     * @param HttpClient  $httpClient
71
     *
72 680
     * @return Client
73
     */
74 680
    public function setHttpClient(HttpClient $httpClient)
75
    {
76 680
        $this->http->setClient($httpClient);
77
78
        return $this;
79 2
    }
80
}
81