Skip to content

Commit 42fabca

Browse files
committed
use OptionsResolver in IssueBoards api
1 parent 0f56632 commit 42fabca

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

UPGRADE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ See [documentation](doc/customize.md) to know how to customize the client timeou
2727
* The second argument of `update`, `remove`, `showComments`, `showComment`, `addComment`, `updateComment`, `removeComment`,
2828
`setTimeEstimate`, `resetTimeEstimate`, `addSpentTime` and `resetSpentTime` methods is now a scoped issue id (iid).
2929

30+
## `Gitlab\Api\IssueBoards` changes
31+
32+
* The `all` method second and subsequent arguments have been replaced by a single associative array of query string parameters.
33+
3034
## `Gitlab\Api\MergeRequests` changes
3135

3236
* The `getList`, `getByIid`, `merged`, `opened` and `closed` methods have been removed. Use `all` method instead.

lib/Gitlab/Api/IssueBoards.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,17 @@ class IssueBoards extends AbstractApi
44
{
55
/**
66
* @param int $project_id
7-
* @param int $page
8-
* @param int $per_page
9-
* @param array $params
7+
* @param array $parameters
8+
*
109
* @return mixed
1110
*/
12-
public function all($project_id = null, $page = 1, $per_page = self::PER_PAGE, array $params = array())
11+
public function all($project_id = null, array $parameters = [])
1312
{
14-
$path = $project_id === null ? 'boards' : $this->getProjectPath($project_id, 'boards');
13+
$resolver = $this->createOptionsResolver();
1514

16-
$params = array_merge(array(
17-
'page' => $page,
18-
'per_page' => $per_page
19-
), $params);
15+
$path = $project_id === null ? 'boards' : $this->getProjectPath($project_id, 'boards');
2016

21-
return $this->get($path, $params);
17+
return $this->get($path, $resolver->resolve($parameters));
2218
}
2319

2420
/**

test/Gitlab/Tests/Api/IssueBoardsTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php namespace Gitlab\Tests\Api;
22

3-
use Gitlab\Api\AbstractApi;
4-
53
class IssueBoardsTest extends TestCase
64
{
75
/**
@@ -17,7 +15,7 @@ public function shouldGetAllBoards()
1715
$api = $this->getApiMock();
1816
$api->expects($this->once())
1917
->method('get')
20-
->with('boards', array('page' => 1, 'per_page' => AbstractApi::PER_PAGE))
18+
->with('boards', array())
2119
->will($this->returnValue($expectedArray))
2220
;
2321

0 commit comments

Comments
 (0)