1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace JiraRestApi\Board; |
4
|
|
|
|
5
|
|
|
use JiraRestApi\Configuration\ConfigurationInterface; |
6
|
|
|
use JiraRestApi\Issue\Issue; |
7
|
|
|
use JiraRestApi\Sprint\Sprint; |
8
|
|
|
use Psr\Log\LoggerInterface; |
9
|
|
|
|
10
|
|
|
class BoardService extends \JiraRestApi\JiraClient |
11
|
|
|
{ |
12
|
|
|
private $uri = '/board'; |
13
|
|
|
|
14
|
|
|
public function __construct(ConfigurationInterface $configuration = null, LoggerInterface $logger = null, $path = './') |
15
|
|
|
{ |
16
|
|
|
parent::__construct($configuration, $logger, $path); |
17
|
|
|
$this->setAPIUri('/rest/agile/1.0'); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* get all boards list. |
22
|
|
|
* |
23
|
|
|
* @param array $paramArray |
24
|
|
|
* |
25
|
|
|
* @throws \JiraRestApi\JiraException |
26
|
|
|
* |
27
|
|
|
* @return Board[] array of Board class |
28
|
|
|
*/ |
29
|
|
|
public function getBoardList($paramArray = []) |
30
|
|
|
{ |
31
|
|
|
$json = $this->exec($this->uri.$this->toHttpQueryParameter($paramArray), null); |
32
|
|
|
$boards = $this->json_mapper->mapArray( |
33
|
|
|
json_decode($json)->values, new \ArrayObject(), Board::class |
34
|
|
|
); |
35
|
|
|
|
36
|
|
|
return $boards; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function getBoard($id, $paramArray = []) |
40
|
|
|
{ |
41
|
|
|
$json = $this->exec($this->uri.'/'.$id.$this->toHttpQueryParameter($paramArray), null); |
42
|
|
|
$board = $this->json_mapper->map( |
43
|
|
|
json_decode($json), new Board() |
44
|
|
|
); |
45
|
|
|
|
46
|
|
|
return $board; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function getBoardIssues($id, $paramArray = []) |
50
|
|
|
{ |
51
|
|
|
$json = $this->exec($this->uri.'/'.$id.'/issue'.$this->toHttpQueryParameter($paramArray), null); |
52
|
|
|
$issues = $this->json_mapper->mapArray( |
53
|
|
|
json_decode($json)->issues, new \ArrayObject(), Issue::class |
54
|
|
|
); |
55
|
|
|
|
56
|
|
|
return $issues; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function getBoardSprints($boardId, $paramArray = []) |
60
|
|
|
{ |
61
|
|
|
$json = $this->exec($this->uri.'/'.$boardId.'/sprint'.$this->toHttpQueryParameter($paramArray), null); |
62
|
|
|
$sprints = $this->json_mapper->mapArray( |
63
|
|
|
json_decode($json)->values, |
64
|
|
|
new \ArrayObject(), |
65
|
|
|
Sprint::class |
66
|
|
|
); |
67
|
|
|
|
68
|
|
|
return $sprints; |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|