Skip to content

Commit eeafe13

Browse files
committed
Merge pull request kbsali#102 from JanMalte/fix-scrutinizer-issues
Fix scrutinizer issues
2 parents c3eae98 + f27af98 commit eeafe13

File tree

5 files changed

+47
-19
lines changed

5 files changed

+47
-19
lines changed

lib/Redmine/Api/AbstractApi.php

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,49 @@ public function lastCallFailed()
3838
}
3939

4040
/**
41-
* {@inheritDoc}
41+
* Perform the client get() method.
42+
*
43+
* @param string $path
44+
*
45+
* @return array
4246
*/
4347
protected function get($path)
4448
{
4549
return $this->client->get($path);
4650
}
4751

4852
/**
49-
* {@inheritDoc}
53+
* Perform the client post() method.
54+
*
55+
* @param string $path
56+
* @param string $data
57+
*
58+
* @return string|false
5059
*/
5160
protected function post($path, $data)
5261
{
5362
return $this->client->post($path, $data);
5463
}
5564

5665
/**
57-
* {@inheritDoc}
66+
* Perform the client put() method.
67+
*
68+
* @param string $path
69+
* @param string $data
70+
*
71+
* @return string|false
5872
*/
5973
protected function put($path, $data)
6074
{
6175
return $this->client->put($path, $data);
6276
}
6377

6478
/**
65-
* {@inheritDoc}
79+
* Perform the client delete() method.
80+
*
81+
* @param string $path
82+
*
83+
* @return array
6684
*/
6785
protected function delete($path)
6886
{
@@ -141,7 +159,7 @@ protected function retrieveAll($endpoint, array $params = array())
141159
*
142160
* @param SimpleXMLElement $xml XML Element the custom fields are attached to
143161
* @param array $fields array of fields to attach, each field needs name, id and value set
144-
* @return $xml Element
162+
* @return SimpleXMLElement $xml
145163
* @see http://www.redmine.org/projects/redmine/wiki/Rest_api#Working-with-custom-fields
146164
*/
147165
protected function attachCustomFieldXML(SimpleXMLElement $xml, array $fields)

lib/Redmine/Api/Issue.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function removeWatcher($id, $watcher_user_id)
196196
/**
197197
* @param int $id
198198
* @param string $status
199-
* @return void
199+
* @return SimpleXMLElement
200200
*/
201201
public function setIssueStatus($id, $status)
202202
{
@@ -210,7 +210,7 @@ public function setIssueStatus($id, $status)
210210
/**
211211
* @param int $id
212212
* @param string $note
213-
* @return void
213+
* @return SimpleXMLElement
214214
*/
215215
public function addNoteToIssue($id, $note)
216216
{
@@ -265,6 +265,7 @@ private function cleanParams(array $params = array())
265265
*/
266266
public function attach($id, array $attachment)
267267
{
268+
$request = array();
268269
$request['issue'] = array(
269270
'id' => $id,
270271
'uploads' => array(

lib/Redmine/Api/Project.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function listing($forceUpdate = false, $reverse = true)
4949
/**
5050
* Get a project id given its name
5151
* @param string $name
52-
* @return int
52+
* @return integer|boolean
5353
*/
5454
public function getIdByName($name)
5555
{

lib/Redmine/Api/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getCurrentUser()
6060
/**
6161
* Get a user id given its username
6262
* @param string $username
63-
* @return int
63+
* @return integer|boolean
6464
*/
6565
public function getIdByUsername($username)
6666
{

lib/Redmine/Client.php

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Client
9090
public function __construct($url, $apikeyOrUsername, $pass = null)
9191
{
9292
$this->url = $url;
93-
$this->getPort($url);
93+
$this->getPort();
9494
$this->apikeyOrUsername = $apikeyOrUsername;
9595
$this->pass = $pass;
9696
}
@@ -159,9 +159,13 @@ public function get($path)
159159
}
160160

161161
/**
162-
* Decodes json response
162+
* Decodes json response.
163+
*
164+
* Returns $json if no error occured during decoding but decoded value is
165+
* null.
166+
*
163167
* @param string $json
164-
* @return array
168+
* @return array|string
165169
*/
166170
public function decode($json)
167171
{
@@ -293,7 +297,7 @@ public function getPort()
293297
/**
294298
* Sets to an existing username so api calls can be
295299
* impersonated to this user
296-
* @param string $username
300+
* @param string|null $username
297301
* @return Client
298302
*/
299303
public function setImpersonateUser($username = null)
@@ -304,19 +308,23 @@ public function setImpersonateUser($username = null)
304308
}
305309

306310
/**
307-
* @return mixed
311+
* Get the impersonate user.
312+
*
313+
* @return string|null
308314
*/
309315
public function getImpersonateUser()
310316
{
311317
return $this->impersonateUser;
312318
}
313319

314320
/**
315-
* @param string $path
316-
* @param string $method
317-
* @param string $data
318-
* @return false|SimpleXMLElement|string
319-
* @throws \Exception If anything goes wrong on curl request
321+
* @param string $path
322+
* @param string $method
323+
* @param string $data
324+
*
325+
* @return boolean|SimpleXMLElement|string
326+
*
327+
* @throws \Exception If anything goes wrong on curl request
320328
*/
321329
protected function runRequest($path, $method = 'GET', $data = '')
322330
{
@@ -386,6 +394,7 @@ protected function runRequest($path, $method = 'GET', $data = '')
386394
default: // GET
387395
break;
388396
}
397+
/* @var $response boolean|string */
389398
$response = curl_exec($curl);
390399
$this->responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
391400
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);

0 commit comments

Comments
 (0)