1 | <?php |
||
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) |
|
54 | |||
55 | /** |
||
56 | * Returns the name of the data service |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | 2 | public function getName() |
|
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) |
|
75 | |||
76 | /** |
||
77 | * Returns the API connector |
||
78 | * |
||
79 | * @return \stdClass |
||
80 | */ |
||
81 | 2 | public function getConnector() |
|
85 | |||
86 | /** |
||
87 | * Sets the configuration |
||
88 | * |
||
89 | * @param array $config |
||
90 | * @return void |
||
91 | */ |
||
92 | 17 | public function setConfig(array $config) |
|
96 | |||
97 | /** |
||
98 | * Gets the configuration |
||
99 | * |
||
100 | * @return array |
||
101 | */ |
||
102 | 4 | public function getConfig() |
|
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) |
|
117 | |||
118 | /** |
||
119 | * Gets the query limit |
||
120 | * |
||
121 | * @return int |
||
122 | */ |
||
123 | 2 | public function getQueryLimit() |
|
132 | |||
133 | /** |
||
134 | * Gets the Host |
||
135 | * |
||
136 | * @return string |
||
137 | */ |
||
138 | 2 | public function getHost() |
|
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 | } |