Skip to content

Commit fcf0c1f

Browse files
committed
cs fix
1 parent 02b0f26 commit fcf0c1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+682
-819
lines changed

example.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
// Project
5959
$client->api('project')->all();
6060
$client->api('project')->all(array(
61-
'limit' => 10
61+
'limit' => 10,
6262
));
6363
$client->api('project')->listing();
6464
$client->api('project')->listing();
@@ -82,7 +82,7 @@
8282
$client->api('user')->getIdByUsername('kbsali');
8383
$client->api('user')->show($userId);
8484
$client->api('user')->update($userId, array(
85-
'firstname' => 'Raul'
85+
'firstname' => 'Raul',
8686
));
8787
$client->api('user')->remove($userId);
8888
$client->api('user')->create(array(
@@ -96,7 +96,7 @@
9696
// Issues
9797
$client->api('issue')->show($issueId);
9898
$client->api('issue')->all(array(
99-
'limit' => 100
99+
'limit' => 100,
100100
));
101101
$client->api('issue')->all(array('category_id' => $categoryId));
102102
$client->api('issue')->all(array('tracker_id' => $trackerId));
@@ -154,16 +154,16 @@
154154
$client->api('issue')->remove($issueId);
155155

156156
// To upload a file + attach it to an existing issue with $issueId
157-
$upload = json_decode( $client->api('attachment')->upload($filecontent) );
157+
$upload = json_decode($client->api('attachment')->upload($filecontent));
158158
$client->api('issue')->attach($issueId, array(
159159
'token' => $upload->upload->token,
160160
'filename' => 'MyFile.pdf',
161161
'description' => 'MyFile is better then YourFile...',
162-
'content_type' => 'application/pdf'
162+
'content_type' => 'application/pdf',
163163
));
164164

165165
// Or, create a new issue with the file attached in one step
166-
$upload = json_decode( $client->api('attachment')->upload($filecontent) );
166+
$upload = json_decode($client->api('attachment')->upload($filecontent));
167167
$client->api('issue')->create(array(
168168
'project_id' => 'myproject',
169169
'subject' => 'A test issue',
@@ -173,9 +173,9 @@
173173
'token' => $upload->upload->token,
174174
'filename' => 'MyFile.pdf',
175175
'description' => 'MyFile is better then YourFile...',
176-
'content_type'=> 'application/pdf'
177-
)
178-
)
176+
'content_type' => 'application/pdf',
177+
),
178+
),
179179
));
180180

181181
// ----------------------------
@@ -192,7 +192,7 @@
192192
));
193193
$client->api('issue_category')->remove($categoryId);
194194
$client->api('issue_category')->remove($categoryId, array(
195-
'reassign_to_id' => $userId
195+
'reassign_to_id' => $userId,
196196
));
197197

198198
// ----------------------------
@@ -302,7 +302,6 @@
302302
));
303303
$client->api('wiki')->remove('testProject', 'about');
304304

305-
306305
// ----------------------------
307306
// Issues' stats (see https://github.com/kbsali/php-redmine-api/issues/44)
308307
$issues['all'] = $client->api('issue')->all([

lib/Redmine/Api/AbstractApi.php

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
use Redmine\Client;
66

77
/**
8-
* Abstract class for Api classes
8+
* Abstract class for Api classes.
99
*
1010
* @author Kevin Saliou <kevin at saliou dot name>
1111
*/
1212
abstract class AbstractApi
1313
{
1414
/**
15-
* The client
15+
* The client.
1616
*
1717
* @var Client
1818
*/
@@ -28,6 +28,7 @@ public function __construct(Client $client)
2828

2929
/**
3030
* Returns whether or not the last api call failed.
31+
*
3132
* @return bool
3233
*/
3334
public function lastCallFailed()
@@ -88,7 +89,7 @@ protected function delete($path)
8889
}
8990

9091
/**
91-
* Checks if the variable passed is not null
92+
* Checks if the variable passed is not null.
9293
*
9394
* @param mixed $var Variable to be checked
9495
*
@@ -100,12 +101,12 @@ protected function isNotNull($var)
100101
false !== $var &&
101102
null !== $var &&
102103
'' !== $var &&
103-
!( (is_array($var) || is_object($var)) && empty($var) );
104+
!((is_array($var) || is_object($var)) && empty($var));
104105
}
105106

106107
/**
107-
* @param array $defaults
108-
* @param array $params
108+
* @param array $defaults
109+
* @param array $params
109110
*
110111
* @return array
111112
*/
@@ -118,11 +119,12 @@ protected function sanitizeParams(array $defaults, array $params)
118119
}
119120
/**
120121
* Retrieves all the elements of a given endpoint (even if the
121-
* total number of elements is greater than 100)
122+
* total number of elements is greater than 100).
123+
*
124+
* @param string $endpoint API end point
125+
* @param array $params optional parameters to be passed to the api (offset, limit, ...)
122126
*
123-
* @param string $endpoint API end point
124-
* @param array $params optional parameters to be passed to the api (offset, limit, ...)
125-
* @return array elements found
127+
* @return array elements found
126128
*/
127129
protected function retrieveAll($endpoint, array $params = array())
128130
{
@@ -169,11 +171,13 @@ protected function retrieveAll($endpoint, array $params = array())
169171
}
170172

171173
/**
172-
* Attaches Custom Fields to a create/update query
174+
* Attaches Custom Fields to a create/update query.
175+
*
176+
* @param SimpleXMLElement $xml XML Element the custom fields are attached to
177+
* @param array $fields array of fields to attach, each field needs name, id and value set
173178
*
174-
* @param SimpleXMLElement $xml XML Element the custom fields are attached to
175-
* @param array $fields array of fields to attach, each field needs name, id and value set
176179
* @return SimpleXMLElement $xml
180+
*
177181
* @see http://www.redmine.org/projects/redmine/wiki/Rest_api#Working-with-custom-fields
178182
*/
179183
protected function attachCustomFieldXML(SimpleXMLElement $xml, array $fields)

lib/Redmine/Api/Attachment.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,33 @@
33
namespace Redmine\Api;
44

55
/**
6-
* Attachment details
6+
* Attachment details.
77
*
88
* @link http://www.redmine.org/projects/redmine/wiki/Rest_Attachments
9+
*
910
* @author Kevin Saliou <kevin at saliou dot name>
1011
*/
1112
class Attachment extends AbstractApi
1213
{
1314
/**
14-
* Get extended information about an attachment
15+
* Get extended information about an attachment.
16+
*
1517
* @link http://www.redmine.org/projects/redmine/wiki/Rest_Attachments
1618
*
17-
* @param string $id the attachment number
18-
* @return array information about the attachment
19+
* @param string $id the attachment number
20+
*
21+
* @return array information about the attachment
1922
*/
2023
public function show($id)
2124
{
2225
return $this->get('/attachments/'.urlencode($id).'.json');
2326
}
2427

2528
/**
26-
* Get attachment content as a binary file
29+
* Get attachment content as a binary file.
30+
*
31+
* @param string $id the attachment number
2732
*
28-
* @param string $id the attachment number
2933
* @return string the attachment content
3034
*/
3135
public function download($id)
@@ -34,11 +38,13 @@ public function download($id)
3438
}
3539

3640
/**
37-
* Upload a file to redmine
41+
* Upload a file to redmine.
42+
*
3843
* @link http://www.redmine.org/projects/redmine/wiki/Rest_api#Attaching-files
3944
*
40-
* @param string $attachment the attachment content
41-
* @return array information about the attachment
45+
* @param string $attachment the attachment content
46+
*
47+
* @return array information about the attachment
4248
*/
4349
public function upload($attachment)
4450
{

lib/Redmine/Api/CustomField.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@
33
namespace Redmine\Api;
44

55
/**
6-
* Listing custom fields
6+
* Listing custom fields.
77
*
88
* @link http://www.redmine.org/projects/redmine/wiki/Rest_CustomFields
9+
*
910
* @author Kevin Saliou <kevin at saliou dot name>
1011
*/
1112
class CustomField extends AbstractApi
1213
{
1314
private $customFields = array();
1415

1516
/**
16-
* List custom fields
17+
* List custom fields.
18+
*
1719
* @link http://www.redmine.org/projects/redmine/wiki/Rest_CustomFields#GET
1820
*
19-
* @param array $params optional parameters to be passed to the api (offset, limit, ...)
21+
* @param array $params optional parameters to be passed to the api (offset, limit, ...)
22+
*
2023
* @return array list of custom fields found
2124
*/
2225
public function all(array $params = array())
@@ -27,10 +30,11 @@ public function all(array $params = array())
2730
}
2831

2932
/**
30-
* Returns an array of custom fields with name/id pairs
33+
* Returns an array of custom fields with name/id pairs.
3134
*
32-
* @param boolean $forceUpdate to force the update of the custom fields var
33-
* @return array list of custom fields (id => name)
35+
* @param boolean $forceUpdate to force the update of the custom fields var
36+
*
37+
* @return array list of custom fields (id => name)
3438
*/
3539
public function listing($forceUpdate = false)
3640
{
@@ -46,9 +50,10 @@ public function listing($forceUpdate = false)
4650
}
4751

4852
/**
49-
* Get a tracket id given its name
53+
* Get a tracket id given its name.
54+
*
55+
* @param string|int $name customer field name
5056
*
51-
* @param string|int $name customer field name
5257
* @return int|false
5358
*/
5459
public function getIdByName($name)

lib/Redmine/Api/Group.php

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@
33
namespace Redmine\Api;
44

55
/**
6-
* Handling of groups
6+
* Handling of groups.
77
*
88
* @link http://www.redmine.org/projects/redmine/wiki/Rest_Groups
9+
*
910
* @author Kevin Saliou <kevin at saliou dot name>
1011
*/
1112
class Group extends AbstractApi
1213
{
1314
private $groups = array();
1415

1516
/**
16-
* List groups
17+
* List groups.
18+
*
1719
* @link http://www.redmine.org/projects/redmine/wiki/Rest_Groups#GET
1820
*
19-
* @param array $params optional parameters to be passed to the api (offset, limit, ...)
21+
* @param array $params optional parameters to be passed to the api (offset, limit, ...)
22+
*
2023
* @return array list of groups found
2124
*/
2225
public function all(array $params = array())
@@ -27,10 +30,11 @@ public function all(array $params = array())
2730
}
2831

2932
/**
30-
* Returns an array of groups with name/id pairs
33+
* Returns an array of groups with name/id pairs.
34+
*
35+
* @param boolean $forceUpdate to force the update of the groups var
3136
*
32-
* @param boolean $forceUpdate to force the update of the groups var
33-
* @return array list of groups (id => name)
37+
* @return array list of groups (id => name)
3438
*/
3539
public function listing($forceUpdate = false)
3640
{
@@ -46,10 +50,12 @@ public function listing($forceUpdate = false)
4650
}
4751

4852
/**
49-
* Create a new group with a group of users assigned
53+
* Create a new group with a group of users assigned.
54+
*
5055
* @link http://www.redmine.org/projects/redmine/wiki/Rest_Groups#POST
5156
*
52-
* @param array $params the new group data
57+
* @param array $params the new group data
58+
*
5359
* @return SimpleXMLElement
5460
*/
5561
public function create(array $params = array())
@@ -78,11 +84,13 @@ public function create(array $params = array())
7884

7985
/**
8086
* Returns details of a group.
87+
*
8188
* @link http://www.redmine.org/projects/redmine/wiki/Rest_Groups#GET-2
8289
* available $params :
8390
* - include: a coma separated list of associations to include in the response: users,memberships
8491
*
85-
* @param int $id the group id
92+
* @param int $id the group id
93+
*
8694
* @return array
8795
*/
8896
public function show($id, array $params = array())
@@ -91,10 +99,12 @@ public function show($id, array $params = array())
9199
}
92100

93101
/**
94-
* Delete a group
102+
* Delete a group.
103+
*
95104
* @link http://www.redmine.org/projects/redmine/wiki/Rest_Groups#DELETE
96105
*
97-
* @param int $id id of the group
106+
* @param int $id id of the group
107+
*
98108
* @return string
99109
*/
100110
public function remove($id)
@@ -103,11 +113,13 @@ public function remove($id)
103113
}
104114

105115
/**
106-
* Adds an existing user to a group
116+
* Adds an existing user to a group.
117+
*
107118
* @link http://www.redmine.org/projects/redmine/wiki/Rest_Groups#POST-2
108119
*
109-
* @param int $id id of the group
110-
* @param int $userId id of the user
120+
* @param int $id id of the group
121+
* @param int $userId id of the user
122+
*
111123
* @return string
112124
*/
113125
public function addUser($id, $userId)
@@ -118,11 +130,13 @@ public function addUser($id, $userId)
118130
}
119131

120132
/**
121-
* Removes a user from a group
133+
* Removes a user from a group.
134+
*
122135
* @link http://www.redmine.org/projects/redmine/wiki/Rest_Groups#DELETE-2
123136
*
124-
* @param int $id id of the group
125-
* @param int $userId id of the user
137+
* @param int $id id of the group
138+
* @param int $userId id of the user
139+
*
126140
* @return string
127141
*/
128142
public function removeUser($id, $userId)

0 commit comments

Comments
 (0)