GitLabManager   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 53
ccs 10
cts 10
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFactory() 0 3 1
A getConfigName() 0 3 1
A createConnection() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Laravel GitLab.
7
 *
8
 * (c) Graham Campbell <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace GrahamCampbell\GitLab;
15
16
use GrahamCampbell\Manager\AbstractManager;
17
use Illuminate\Contracts\Config\Repository;
18
19
/**
20
 * This is the gitlab manager class.
21
 *
22
 * @method \Gitlab\Api\DeployKeys deployKeys()
23
 * @method \Gitlab\Api\Groups groups()
24
 * @method \Gitlab\Api\Issues issues()
25
 * @method \Gitlab\Api\IssueBoards issueBoards()
26
 * @method \Gitlab\Api\Jobs jobs()
27
 * @method \Gitlab\Api\MergeRequests mergeRequests()
28
 * @method \Gitlab\Api\Milestones milestones()
29
 * @method \Gitlab\Api\ProjectNamespaces namespaces()
30
 * @method \Gitlab\Api\Projects projects()
31
 * @method \Gitlab\Api\Repositories repositories()
32
 * @method \Gitlab\Api\RepositoryFiles repositoryFiles()
33
 * @method \Gitlab\Api\Snippets snippets()
34
 * @method \Gitlab\Api\SystemHooks systemHooks()
35
 * @method \Gitlab\Api\Users users()
36
 * @method \Gitlab\Api\Keys keys()
37
 * @method \Gitlab\Api\Tags tags()
38
 * @method \Gitlab\Api\Version version()
39
 * @method \Gitlab\Api\ApiInterface api(string $name)
40
 * @method void authenticate(string $token, string|null $authMethod = null, string|null $sudo = null)
41
 * @method void setUrl(string $url)
42
 * @method \Http\Client\Common\HttpMethodsClient getHttpClient()
43
 * @method \Gitlab\HttpClient\Plugin\History getResponseHistory()
44
 *
45
 * @author Graham Campbell <[email protected]>
46
 */
47
class GitLabManager extends AbstractManager
48
{
49
    /**
50
     * The factory instance.
51
     *
52
     * @var \GrahamCampbell\GitLab\GitLabFactory
53
     */
54
    protected $factory;
55
56
    /**
57
     * Create a new gitlab manager instance.
58
     *
59
     * @param \Illuminate\Contracts\Config\Repository $config
60
     * @param \GrahamCampbell\GitLab\GitLabFactory    $factory
61
     *
62
     * @return void
63
     */
64 48
    public function __construct(Repository $config, GitLabFactory $factory)
65
    {
66 48
        parent::__construct($config);
67 48
        $this->factory = $factory;
68 48
    }
69
70
    /**
71
     * Create the connection instance.
72
     *
73
     * @param array $config
74
     *
75
     * @return \Gitlab\Client
76
     */
77 24
    protected function createConnection(array $config)
78
    {
79 24
        return $this->factory->make($config);
80
    }
81
82
    /**
83
     * Get the configuration name.
84
     *
85
     * @return string
86
     */
87 24
    protected function getConfigName()
88
    {
89 24
        return 'gitlab';
90
    }
91
92
    /**
93
     * Get the factory instance.
94
     *
95
     * @return \GrahamCampbell\GitLab\GitLabFactory
96
     */
97 12
    public function getFactory()
98
    {
99 12
        return $this->factory;
100
    }
101
}
102