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