From bb9040d6f3b5d82274e83771528d21d489aeeb01 Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Mon, 14 Jul 2014 11:28:37 +0900 Subject: [PATCH 1/2] decorate for old php --- Jira/Api.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Jira/Api.php b/Jira/Api.php index 52c865a..b5e98e4 100644 --- a/Jira/Api.php +++ b/Jira/Api.php @@ -507,9 +507,9 @@ protected function automapFields($issue) */ public function setWatchers($issueKey, $watchers) { - $result=[]; + $result = array(); foreach($watchers as $w){ - $result[]=$this->api(self::REQUEST_POST, sprintf("/rest/api/2/issue/%s/watchers", $issueKey), "\"".$w."\""); + $result[] = $this->api(self::REQUEST_POST, sprintf("/rest/api/2/issue/%s/watchers", $issueKey), "\"".$w."\""); } return $result; } @@ -519,17 +519,25 @@ public function setWatchers($issueKey, $watchers) * * @param $issueKey * @return mixed + * + * @TODO: should have parameters? (e.g comment) */ public function closeIssue($issueKey) { - $result=[]; + $result = array(); // get available transitions - $transitions=$this->getTransitions($issueKey,[])->getResult()['transitions']; + $tmp_transitions = $this->getTransitions($issueKey, array()); + $tmp_transitions_result = $tmp_transitions->getResult(); + $transitions = $tmp_transitions_result['transitions']; + // search id for closing ticket foreach ($transitions as $v) { // Close ticket if required id was found - if($v['name']=="Close Issue"){ - $result=$this->transition($issueKey,['transition'=>['id'=>$v['id']]]); + if($v['name'] == "Close Issue"){ + $result = $this->transition($issueKey, array( + 'transition'=> array( + 'id'=>$v['id'] + ))); break; } } From 87d6dea6211199d5702c03fb6797841958e95c91 Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Mon, 14 Jul 2014 20:59:59 +0900 Subject: [PATCH 2/2] decorate white spaces --- Jira/Api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jira/Api.php b/Jira/Api.php index b6afd1a..4bb6b3f 100644 --- a/Jira/Api.php +++ b/Jira/Api.php @@ -509,7 +509,7 @@ public function setWatchers($issueKey, $watchers) { $result = array(); foreach($watchers as $w){ - $result[]=$this->api(self::REQUEST_POST, sprintf("/rest/api/2/issue/%s/watchers", $issueKey), $w); + $result[] = $this->api(self::REQUEST_POST, sprintf("/rest/api/2/issue/%s/watchers", $issueKey), $w); } return $result; }