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.

BaseDataService   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 167
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 92.31%
Metric Value
wmc 10
lcom 2
cbo 0
dl 0
loc 167
ccs 24
cts 26
cp 0.9231
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A setName() 0 4 1
A getName() 0 4 1
A setConnector() 0 4 1
A getConnector() 0 4 1
A setConfig() 0 4 1
A getConfig() 0 4 1
A setQueryLimit() 0 4 1
A getQueryLimit() 0 9 2
A getHost() 0 6 1
transformJsonResponse() 0 1 ?
getProjects() 0 1 ?
getChangesets() 0 1 ?
getVersion() 0 1 ?
1
<?php
2
/**
3
 * This file is part of the Gerrie package.
4
 *
5
 * (c) Andreas Grunwald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Gerrie\API\DataService;
12
13
abstract class BaseDataService implements DataServiceInterface
14
{
15
16
    /**
17
     * Name of data service
18
     *
19
     * @var string
20
     */
21
    private $name = '';
22
23
    /**
24
     * API connector like HTTP or SSH
25
     *
26
     * @var object
27
     */
28
    private $connector = null;
29
30
    /**
31
     * Query limit
32
     *
33
     * @var int|null
34
     */
35
    private $queryLimit = null;
36
37
    /**
38
     * Configuration
39
     *
40
     * @var array
41
     */
42
    protected $config = array();
43
44
    /**
45
     * Sets the name of the data service
46
     *
47
     * @param string $name Name of data service
48
     * @return void
49
     */
50 17
    public function setName($name)
51
    {
52 17
        $this->name = (string) $name;
53 17
    }
54
55
    /**
56
     * Returns the name of the data service
57
     *
58
     * @return string
59
     */
60 2
    public function getName()
61
    {
62 2
        return $this->name;
63
    }
64
65
    /**
66
     * Sets the API connector
67
     *
68
     * @param \Buzz\Browser|\Gerrie\Component\Connection\SSH $connector API connector like HTTP Client
69
     * @return void
70
     */
71 17
    public function setConnector($connector)
72
    {
73 17
        $this->connector = $connector;
74 17
    }
75
76
    /**
77
     * Returns the API connector
78
     *
79
     * @return \stdClass
80
     */
81 2
    public function getConnector()
82
    {
83 2
        return $this->connector;
84
    }
85
86
    /**
87
     * Sets the configuration
88
     *
89
     * @param array $config
90
     * @return void
91
     */
92 17
    public function setConfig(array $config)
93
    {
94 17
        $this->config = $config;
95 17
    }
96
97
    /**
98
     * Gets the configuration
99
     *
100
     * @return array
101
     */
102 4
    public function getConfig()
103
    {
104 4
        return $this->config;
105
    }
106
107
    /**
108
     * Sets the query limit
109
     *
110
     * @param int $queryLimit The query limit for Gerrit querys
111
     * @return void
112
     */
113 2
    public function setQueryLimit($queryLimit)
114
    {
115 2
        $this->queryLimit = intval($queryLimit);
116 2
    }
117
118
    /**
119
     * Gets the query limit
120
     *
121
     * @return int
122
     */
123 2
    public function getQueryLimit()
124
    {
125
126 2
        if ($this->queryLimit === null) {
127
            $this->setQueryLimit($this->initQueryLimit());
128
        }
129
130 2
        return $this->queryLimit;
131
    }
132
133
    /**
134
     * Gets the Host
135
     *
136
     * @return string
137
     */
138 2
    public function getHost()
139
    {
140 2
        $config = $this->getConfig();
141
142 2
        return $config['host'];
143
    }
144
145
    /**
146
     * Transforms a JSON string into an array.
147
     * Regular, the json is the content from the response.
148
     *
149
     * @param string $json The json string
150
     * @return array|null
151
     */
152
    abstract public function transformJsonResponse($json);
153
154
    /**
155
     * Requests projects at the Gerrit server
156
     *
157
     * @return array|null
158
     */
159
    abstract public function getProjects();
160
161
    /**
162
     * Requests changesets at the Gerrit server.
163
     *
164
     * @param string $projectName The project name
165
     * @param string $resumeKey The key where the request will be resumed
166
     * @param integer $start Number of changesets which will be skipped
167
     * @throws \Exception
168
     */
169
    abstract public function getChangesets($projectName, $resumeKey = null, $start = 0);
170
171
    /**
172
     * Returns the version of the Gerrit server
173
     *
174
     * @link https://review.typo3.org/Documentation/cmd-version.html
175
     *
176
     * @return string
177
     */
178
    abstract public function getVersion();
179
}