1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: meshulam |
5
|
|
|
* Date: 11/08/2017 |
6
|
|
|
* Time: 17:28. |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace JiraRestApi\Sprint; |
10
|
|
|
|
11
|
|
|
use JiraRestApi\Configuration\ConfigurationInterface; |
12
|
|
|
use JiraRestApi\Issue\Issue; |
13
|
|
|
use JiraRestApi\JiraClient; |
14
|
|
|
use JiraRestApi\JiraException; |
15
|
|
|
use Psr\Log\LoggerInterface; |
16
|
|
|
|
17
|
|
|
class SprintService extends JiraClient |
18
|
|
|
{ |
19
|
|
|
//https://jira01.devtools.intel.com/rest/agile/1.0/board?projectKeyOrId=34012 |
20
|
|
|
private $uri = '/sprint'; |
21
|
|
|
|
22
|
|
|
public function __construct(ConfigurationInterface $configuration = null, LoggerInterface $logger = null, $path = './') |
23
|
|
|
{ |
24
|
|
|
parent::__construct($configuration, $logger, $path); |
25
|
|
|
$this->setAPIUri('/rest/agile/1.0'); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function getSprintFromJSON($json) |
29
|
|
|
{ |
30
|
|
|
$sprint = $this->json_mapper->map( |
31
|
|
|
$json, new Sprint() |
32
|
|
|
); |
33
|
|
|
|
34
|
|
|
return $sprint; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* get all Sprint list. |
39
|
|
|
* |
40
|
|
|
* @param Sprint $sprintObject |
41
|
|
|
* |
42
|
|
|
* @throws JiraException |
43
|
|
|
* @throws \JsonMapper_Exception |
44
|
|
|
* |
45
|
|
|
* @return object |
46
|
|
|
*/ |
47
|
|
|
public function getSprint($sprintId) |
48
|
|
|
{ |
49
|
|
|
$ret = $this->exec($this->uri.'/'.$sprintId, null); |
50
|
|
|
|
51
|
|
|
$this->log->info("Result=\n".$ret); |
52
|
|
|
|
53
|
|
|
return $sprint = $this->json_mapper->map( |
|
|
|
|
54
|
|
|
json_decode($ret), new Sprint() |
55
|
|
|
); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function getSprintIssues($sprintId, $paramArray = []) |
59
|
|
|
{ |
60
|
|
|
$json = $this->exec($this->uri.'/'.$sprintId.'/issue'.$this->toHttpQueryParameter($paramArray), null); |
61
|
|
|
|
62
|
|
|
$issues = $this->json_mapper->mapArray( |
63
|
|
|
json_decode($json)->issues, |
64
|
|
|
new \ArrayObject(), |
65
|
|
|
Issue::class |
66
|
|
|
); |
67
|
|
|
|
68
|
|
|
return $issues; |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|