@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | $this->log->addDebug('add comment result='.var_export($ret, true)); |
225 | 225 | $comment = $this->json_mapper->map( |
226 | - json_decode($ret), new Comment() |
|
226 | + json_decode($ret), new Comment() |
|
227 | 227 | ); |
228 | 228 | |
229 | 229 | return $comment; |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $data = json_encode(json_decode($ret)->transitions); |
368 | 368 | |
369 | 369 | $transitions = $this->json_mapper->mapArray( |
370 | - json_decode($data), new \ArrayObject(), '\JiraRestApi\Issue\Transition' |
|
370 | + json_decode($data), new \ArrayObject(), '\JiraRestApi\Issue\Transition' |
|
371 | 371 | ); |
372 | 372 | |
373 | 373 | return $transitions; |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | $this->log->addDebug("getTimeTracking res=$ret\n"); |
485 | 485 | |
486 | 486 | $issue = $this->json_mapper->map( |
487 | - json_decode($ret), new Issue() |
|
487 | + json_decode($ret), new Issue() |
|
488 | 488 | ); |
489 | 489 | |
490 | 490 | return $issue->fields->timeTracking; |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | $ret = $this->exec($url, $data, $type); |
586 | 586 | |
587 | 587 | $ret_worklog = $this->json_mapper->map( |
588 | - json_decode($ret), new Worklog() |
|
588 | + json_decode($ret), new Worklog() |
|
589 | 589 | ); |
590 | 590 | |
591 | 591 | return $ret_worklog; |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | $ret = $this->exec('priority', null); |
633 | 633 | |
634 | 634 | $priorities = $this->json_mapper->mapArray( |
635 | - json_decode($ret, false), new \ArrayObject(), '\JiraRestApi\Issue\Priority' |
|
635 | + json_decode($ret, false), new \ArrayObject(), '\JiraRestApi\Issue\Priority' |
|
636 | 636 | ); |
637 | 637 | |
638 | 638 | return $priorities; |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | $this->log->addInfo('Result='.$ret); |
657 | 657 | |
658 | 658 | $prio = $this->json_mapper->map( |
659 | - json_decode($ret), new Priority() |
|
659 | + json_decode($ret), new Priority() |
|
660 | 660 | ); |
661 | 661 | |
662 | 662 | return $prio; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $ret = $this->exec($this->uri, null); |
21 | 21 | |
22 | 22 | $fields = $this->json_mapper->mapArray( |
23 | - json_decode($ret, false), new \ArrayObject(), '\JiraRestApi\Field\Field' |
|
23 | + json_decode($ret, false), new \ArrayObject(), '\JiraRestApi\Field\Field' |
|
24 | 24 | ); |
25 | 25 | |
26 | 26 | // temp array |
@@ -7,27 +7,27 @@ |
||
7 | 7 | |
8 | 8 | class Board implements \JsonSerializable |
9 | 9 | { |
10 | - use ClassSerialize; |
|
10 | + use ClassSerialize; |
|
11 | 11 | |
12 | - /* @var string */ |
|
13 | - public $id; |
|
12 | + /* @var string */ |
|
13 | + public $id; |
|
14 | 14 | |
15 | - /* @var string */ |
|
16 | - public $self; |
|
15 | + /* @var string */ |
|
16 | + public $self; |
|
17 | 17 | |
18 | - /* @var string*/ |
|
19 | - public $name; |
|
18 | + /* @var string*/ |
|
19 | + public $name; |
|
20 | 20 | |
21 | - /* @var string */ |
|
22 | - public $type; |
|
21 | + /* @var string */ |
|
22 | + public $type; |
|
23 | 23 | |
24 | - /* @var array */ |
|
25 | - public $sprintList = []; |
|
24 | + /* @var array */ |
|
25 | + public $sprintList = []; |
|
26 | 26 | |
27 | - public function jsonSerialize() |
|
28 | - { |
|
29 | - return array_filter(get_object_vars($this), function ($var) { |
|
30 | - return !is_null($var); |
|
31 | - }); |
|
32 | - } |
|
27 | + public function jsonSerialize() |
|
28 | + { |
|
29 | + return array_filter(get_object_vars($this), function ($var) { |
|
30 | + return !is_null($var); |
|
31 | + }); |
|
32 | + } |
|
33 | 33 | } |
@@ -21,29 +21,29 @@ discard block |
||
21 | 21 | $this->path = $path; |
22 | 22 | $this->restClient = $jiraClient; |
23 | 23 | if (!$this->restClient) { |
24 | - $this->setRestClient(); |
|
24 | + $this->setRestClient(); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | } |
28 | 28 | public function setRestClient(){ |
29 | - $this->restClient = new JiraClient($this->configuration, $this->logger, $this->path); |
|
30 | - $this->restClient->setAPIUri(''); |
|
29 | + $this->restClient = new JiraClient($this->configuration, $this->logger, $this->path); |
|
30 | + $this->restClient->setAPIUri(''); |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | static function getBoardFromJSON($json) { |
36 | - $json_mapper = new \JsonMapper(); |
|
37 | - $json_mapper->undefinedPropertyHandler = [new \JiraRestApi\JsonMapperHelper(), 'setUndefinedProperty']; |
|
38 | - return $json_mapper->map($json, new Board() ); |
|
36 | + $json_mapper = new \JsonMapper(); |
|
37 | + $json_mapper->undefinedPropertyHandler = [new \JiraRestApi\JsonMapperHelper(), 'setUndefinedProperty']; |
|
38 | + return $json_mapper->map($json, new Board() ); |
|
39 | 39 | } |
40 | 40 | static function getArrayOfBoardsFromJSON($boardList) { |
41 | - $json_mapper = new \JsonMapper(); |
|
42 | - $json_mapper->undefinedPropertyHandler = [new \JiraRestApi\JsonMapperHelper(), 'setUndefinedProperty']; |
|
43 | - return $json_mapper->mapArray($boardList, |
|
41 | + $json_mapper = new \JsonMapper(); |
|
42 | + $json_mapper->undefinedPropertyHandler = [new \JiraRestApi\JsonMapperHelper(), 'setUndefinedProperty']; |
|
43 | + return $json_mapper->mapArray($boardList, |
|
44 | 44 | new \ArrayObject(), |
45 | 45 | '\JiraRestApi\Board\Board' |
46 | - ); |
|
46 | + ); |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | |
@@ -74,46 +74,46 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | public function getBoardWithSprintsList($boardId = null,$paramArray = []){ |
77 | - if (is_null($boardId)) { |
|
77 | + if (is_null($boardId)) { |
|
78 | 78 | $boardList = $this->getAllBoards(); |
79 | 79 | $boards = array(); |
80 | 80 | foreach($boardList as $board) { |
81 | - if ($board->type == 'scrum') { |
|
81 | + if ($board->type == 'scrum') { |
|
82 | 82 | $boards[] = $this->getSprintInfoForBoard($board->id, $paramArray); |
83 | - }else { |
|
83 | + }else { |
|
84 | 84 | $boards[] = $board; |
85 | - } |
|
85 | + } |
|
86 | 86 | } |
87 | - } else { |
|
87 | + } else { |
|
88 | 88 | $boards[] = $this->getSprintInfoForBoard($boardId, $paramArray); |
89 | - } |
|
90 | - return $boards; |
|
89 | + } |
|
90 | + return $boards; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | public function getSprintInfoForBoard($boardId,$paramArray) { |
94 | - $board = $this->getBoard($boardId); |
|
95 | - $sprintList = $this->loopOverResults($this->uri.'/'.$boardId.'/sprint/',$paramArray); |
|
96 | - $sprintObjectsArray = array(); |
|
97 | - foreach ($sprintList as $sprint) { |
|
94 | + $board = $this->getBoard($boardId); |
|
95 | + $sprintList = $this->loopOverResults($this->uri.'/'.$boardId.'/sprint/',$paramArray); |
|
96 | + $sprintObjectsArray = array(); |
|
97 | + foreach ($sprintList as $sprint) { |
|
98 | 98 | $sprintObjectsArray[$sprint->id] = SprintService::getSprintFromJSON($sprint); |
99 | - } |
|
100 | - $board->sprintList = $sprintObjectsArray; |
|
101 | - return $board; |
|
99 | + } |
|
100 | + $board->sprintList = $sprintObjectsArray; |
|
101 | + return $board; |
|
102 | 102 | |
103 | 103 | } |
104 | 104 | |
105 | 105 | public function loopOverResults($uri,$paramArray = []) { |
106 | - $resultsArray = array(); |
|
107 | - $ret = $this->restClient->exec($uri.$this->restClient->toHttpQueryParameter($paramArray), null); |
|
108 | - $results = json_decode($ret); |
|
109 | - while (!$results->isLast) { |
|
106 | + $resultsArray = array(); |
|
107 | + $ret = $this->restClient->exec($uri.$this->restClient->toHttpQueryParameter($paramArray), null); |
|
108 | + $results = json_decode($ret); |
|
109 | + while (!$results->isLast) { |
|
110 | 110 | $resultsArray = array_merge($resultsArray,$results->values); |
111 | 111 | $paramArray['startAt'] = $results->startAt + $results->maxResults; |
112 | 112 | $ret = $this->restClient->exec($this->uri.$this->restClient->toHttpQueryParameter($paramArray), null); |
113 | 113 | $results = json_decode($ret); |
114 | - } |
|
115 | - $resultsArray = array_merge($resultsArray,$results->values); |
|
116 | - return $resultsArray; |
|
114 | + } |
|
115 | + $resultsArray = array_merge($resultsArray,$results->values); |
|
116 | + return $resultsArray; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | class Sprint implements \JsonSerializable |
13 | 13 | { |
14 | - use ClassSerialize; |
|
14 | + use ClassSerialize; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * return only if Project query by key(not id). |
@@ -76,26 +76,26 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | public function getGoal(){ |
79 | - return str_replace(array("\n\r", "\n", "\r"), '', $this->goal); |
|
79 | + return str_replace(array("\n\r", "\n", "\r"), '', $this->goal); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function getStartDate($format = 'Y-m-d H:i:s') { |
83 | - if (!is_null($this->startDate)) { |
|
83 | + if (!is_null($this->startDate)) { |
|
84 | 84 | $date = new \DateTime($this->startDate); |
85 | 85 | return date_format($date, $format); |
86 | - } |
|
87 | - return null; |
|
88 | - // return date_format($this->startDate, $format); |
|
86 | + } |
|
87 | + return null; |
|
88 | + // return date_format($this->startDate, $format); |
|
89 | 89 | |
90 | 90 | } |
91 | 91 | |
92 | 92 | public function getEndDate($format = 'Y-m-d H:i:s') { |
93 | - if (!is_null($this->endDate)){ |
|
93 | + if (!is_null($this->endDate)){ |
|
94 | 94 | $date = new \DateTime($this->endDate); |
95 | 95 | return date_format($date, $format); |
96 | - } |
|
97 | - return null; |
|
98 | - // return date_format($this->endDate, $format); |
|
96 | + } |
|
97 | + return null; |
|
98 | + // return date_format($this->endDate, $format); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | $this->path = $path; |
27 | 27 | $this->restClient = $jiraClient; |
28 | 28 | if (!$this->restClient) { |
29 | - $this->setRestClient(); |
|
29 | + $this->setRestClient(); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | 34 | public function setRestClient(){ |
35 | - $this->restClient = new JiraClient($this->configuration, $this->logger, $this->path); |
|
36 | - $this->restClient->setAPIUri(''); |
|
35 | + $this->restClient = new JiraClient($this->configuration, $this->logger, $this->path); |
|
36 | + $this->restClient->setAPIUri(''); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -61,26 +61,26 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | public function getVelocityForSprint($sprintID){ |
64 | - try { |
|
64 | + try { |
|
65 | 65 | $sprint = $this->getSprint($sprintID); |
66 | 66 | if (!is_null($sprint->originBoardId)){ |
67 | - $ret = $this->restClient->exec('/rest/greenhopper/1.0/rapid/charts/velocity.json?rapidViewId='.$sprint->originBoardId.'&sprintId='.$sprint->id); |
|
68 | - $velocityObject = json_decode($ret); |
|
69 | - $velocityStats = $velocityObject->{'velocityStatEntries'}; |
|
70 | - if (property_exists($velocityStats,$sprint->id)) { |
|
67 | + $ret = $this->restClient->exec('/rest/greenhopper/1.0/rapid/charts/velocity.json?rapidViewId='.$sprint->originBoardId.'&sprintId='.$sprint->id); |
|
68 | + $velocityObject = json_decode($ret); |
|
69 | + $velocityStats = $velocityObject->{'velocityStatEntries'}; |
|
70 | + if (property_exists($velocityStats,$sprint->id)) { |
|
71 | 71 | $sprint->estimatedVelocity = $velocityStats->{$sprint->id}->{'estimated'}->value; |
72 | 72 | $sprint->completedVelocity = $velocityStats->{$sprint->id}->{'completed'}->value; |
73 | - } else { |
|
73 | + } else { |
|
74 | 74 | $sprint->estimatedVelocity = null; |
75 | 75 | $sprint->completedVelocity = null; |
76 | - } |
|
76 | + } |
|
77 | 77 | } |
78 | 78 | return $sprint; |
79 | - } |
|
80 | - catch (JiraException $e) { |
|
79 | + } |
|
80 | + catch (JiraException $e) { |
|
81 | 81 | print("Error Occured! " . $e->getMessage()); |
82 | 82 | return null; |
83 | - } |
|
83 | + } |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | } |