Gitlab::getConnection()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
namespace Integrations\Connectors\Gitlab;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Log;
7
use App\Models\User;
8
use Integrations\Connectors\Connector;
9
10
class Gitlab extends Connector
11
{
12
    public static $ID = 4;
13
    protected function getConnection($token = false)
14
    {
15
        $url = 'http://gitlab.com/';
16
        if (!empty($token->account->customize_url)) {
17
            $url = $token->account->customize_url;
18
        }
19
20
        // return \Gitlab\Client::create($url)
21
        // ->authenticate($token->token, \Gitlab\Client::AUTH_URL_TOKEN);
22
23
        // or for OAuth2 (see https://github.com/m4tthumphrey/php-gitlab-api/blob/master/lib/Gitlab/HttpClient/Plugin/Authentication.php#L47)
24
        return \Gitlab\Client::create($url)
0 ignored issues
show
Bug introduced by
The method create() does not exist on Gitlab\Client. Did you maybe mean createWithHttpClient()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
25
            ->authenticate($token->token, \Gitlab\Client::AUTH_OAUTH_TOKEN);
26
    }
27
}
28