GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (41)

src/Multicoin.php (3 issues)

1
<?php
2
3
namespace Multicoin\Api;
4
5
use Http\Client\Common\Plugin\AuthenticationPlugin;
6
use Http\Client\Common\Plugin\DecoderPlugin;
7
use Http\Client\Common\Plugin\ErrorPlugin;
8
use Http\Client\Common\Plugin\HeaderSetPlugin;
9
use Http\Client\Common\Plugin\QueryDefaultsPlugin;
10
use Http\Client\Common\Plugin\RetryPlugin;
11
use Http\Message\Authentication\Bearer;
12
use Multicoin\Api\Service\ApiClient;
13
use Multicoin\Api\Traits\Address;
14
use Multicoin\Api\Traits\Currency;
15
use Multicoin\Api\Traits\Invoice;
16
use Multicoin\Api\Traits\Transaction;
17
use Multicoin\Api\Traits\User;
18
19
class Multicoin
20
{
21
    use Address;
22
    use Invoice;
23
    use Transaction;
24
    use User;
25
    use Currency;
26
27
    public $coin;
28
    protected $client;
0 ignored issues
show
Protected member variable "client" must contain a leading underscore
Loading history...
29
30
    protected $config;
0 ignored issues
show
Protected member variable "config" must contain a leading underscore
Loading history...
31
32
    public function __construct(array $config = [], $client = null)
33
    {
34
        $this->config = $config;
35
        $this->coin = $config['coin'];
36
        $this->client = $client ?: $this->setClient();
37
        //   $this->setAuth($this->config['key']);
38
        //   parent::__construct($this->setUrl($this->config['url']));
39
    }
40
41
    public function buildQueryParam(array $default, array $param = [])
42
    {
43
        //$data = array_filter(array_merge($default, $param), 'strlen');
44
        $params = array_merge($default, $param);
45
46
        return http_build_query($params);
47
    }
48
49
    public function buildUrl($url)
50
    {
51
        return '/'.trim($this->coin, '/').$url;
52
    }
53
54
    public function setAuth($apiKey = null)
55
    {
56
        if (null === $apiKey) {
57
            $apiKey = config('multicoin.api_token');
58
        }
59
60
        $authentication = new Bearer($apiKey);
61
        $authenticationPlugin = new AuthenticationPlugin($authentication);
62
63
        return $authenticationPlugin;
64
65
        return [
0 ignored issues
show
return array($authenticationPlugin) is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
66
            $authenticationPlugin,
67
        ];
68
    }
69
70
    public function setClient()
71
    {
72
        $plugins = $this->setPlugins($this->config['api_token']);
73
        $baseUrl = $this->setUrl($this->config['url']);
74
75
        return new ApiClient($baseUrl, $plugins);
76
    }
77
78
    public function setPlugins($apiKey = null)
79
    {
80
        $auth = $this->setAuth($apiKey);
81
        $decoderPlugin = new DecoderPlugin();
82
        $headerSetPlugin = new HeaderSetPlugin([
83
            'Accept' => 'application/json',
84
        ]);
85
        $queryDefaultsPlugin = new QueryDefaultsPlugin([
86
            'currency' => 'btc',
87
        ]);
88
89
        return [
90
            $auth,
91
            $decoderPlugin,
92
            $headerSetPlugin,
93
            $queryDefaultsPlugin,
94
            new RetryPlugin(),
95
            new ErrorPlugin(),
96
        ];
97
    }
98
99
    public function setUrl($url = null)
100
    {
101
        if (null === $url) {
102
            return config('multicoin.url');
103
        }
104
105
        return $url;
106
    }
107
}
108