Completed
Pull Request — master (#193)
by
unknown
01:43
created
src/Sprint/Sprint.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         return $this->name;
76 76
     }
77 77
 
78
-    public function getGoal(){
78
+    public function getGoal() {
79 79
       return str_replace(array("\n\r", "\n", "\r"), '', $this->goal);
80 80
     }
81 81
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
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 96
       }
Please login to merge, or discard this patch.
src/Sprint/SprintService.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     }
33 33
 
34
-    public function setRestClient(){
34
+    public function setRestClient() {
35 35
       $this->restClient = new JiraClient($this->configuration, $this->logger, $this->path);
36 36
       $this->restClient->setAPIUri('');
37 37
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $json_mapper = new \JsonMapper();
43 43
         $json_mapper->undefinedPropertyHandler = [new \JiraRestApi\JsonMapperHelper(), 'setUndefinedProperty'];
44
-        return $json_mapper->map($json, new Sprint() );
44
+        return $json_mapper->map($json, new Sprint());
45 45
     }
46 46
 
47 47
     /**
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
         return $this->getSprintFromJSON(json_decode($ret));
61 61
     }
62 62
 
63
-    public function getVelocityForSprint($sprintID){
63
+    public function getVelocityForSprint($sprintID) {
64 64
       try {
65 65
         $sprint = $this->getSprint($sprintID);
66
-        if (!is_null($sprint->originBoardId)){
66
+        if (!is_null($sprint->originBoardId)) {
67 67
           $ret = $this->restClient->exec('/rest/greenhopper/1.0/rapid/charts/velocity.json?rapidViewId='.$sprint->originBoardId.'&sprintId='.$sprint->id);
68 68
           $velocityObject = json_decode($ret);
69 69
           $velocityStats = $velocityObject->{'velocityStatEntries'};
70
-          if (property_exists($velocityStats,$sprint->id)) {
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 73
           } else {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         return $sprint;
79 79
       }
80 80
       catch (JiraException $e) {
81
-        print("Error Occured! " . $e->getMessage());
81
+        print("Error Occured! ".$e->getMessage());
82 82
         return null;
83 83
       }
84 84
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,8 +76,7 @@
 block discarded – undo
76 76
           }
77 77
         }
78 78
         return $sprint;
79
-      }
80
-      catch (JiraException $e) {
79
+      } catch (JiraException $e) {
81 80
         print("Error Occured! " . $e->getMessage());
82 81
         return null;
83 82
       }
Please login to merge, or discard this patch.
src/Board/Board.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
 
26 26
     public function jsonSerialize()
27 27
     {
28
-      return array_filter(get_object_vars($this), function ($var) {
29
-          return !is_null($var);
30
-      });
28
+        return array_filter(get_object_vars($this), function ($var) {
29
+            return !is_null($var);
30
+        });
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     public function jsonSerialize()
27 27
     {
28
-      return array_filter(get_object_vars($this), function ($var) {
28
+      return array_filter(get_object_vars($this), function($var) {
29 29
           return !is_null($var);
30 30
       });
31 31
     }
Please login to merge, or discard this patch.
src/Board/BoardService.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         $this->path = $path;
20 20
         $this->restClient = $jiraClient;
21 21
         if (!$this->restClient) {
22
-          $this->setRestClient();
22
+            $this->setRestClient();
23 23
         }
24 24
 
25 25
     }
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         return $json_mapper->mapArray($boardList,
41 41
                                     new \ArrayObject(),
42 42
                                     '\JiraRestApi\Board\Board'
43
-                                  );
43
+                                    );
44 44
     }
45 45
 
46 46
     /**
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         }
24 24
 
25 25
     }
26
-    public function setRestClient(){
26
+    public function setRestClient() {
27 27
         $this->restClient = new JiraClient($this->configuration, $this->logger, $this->path);
28 28
         $this->restClient->setAPIUri('');
29 29
     }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     static function getBoardFromJSON($json) {
33 33
         $json_mapper = new \JsonMapper();
34 34
         $json_mapper->undefinedPropertyHandler = [new \JiraRestApi\JsonMapperHelper(), 'setUndefinedProperty'];
35
-        return $json_mapper->map($json, new Board() );
35
+        return $json_mapper->map($json, new Board());
36 36
     }
37 37
     static function getArrayOfBoardsFromJSON($boardList) {
38 38
         $json_mapper = new \JsonMapper();
@@ -65,18 +65,18 @@  discard block
 block discarded – undo
65 65
     public function getAllBoards($paramArray = [])
66 66
     {
67 67
         $boardArray = array();
68
-        $boardArray = $this->loopOverResults($this->uri,$paramArray);
68
+        $boardArray = $this->loopOverResults($this->uri, $paramArray);
69 69
         return $this->getArrayOfBoardsFromJSON($boardArray);
70 70
     }
71 71
 
72
-    public function getBoardWithSprintsList($boardId = null,$paramArray = []){
72
+    public function getBoardWithSprintsList($boardId = null, $paramArray = []) {
73 73
         if (is_null($boardId)) {
74 74
         $boardList = $this->getAllBoards();
75 75
         $boards = array();
76
-        foreach($boardList as $board) {
76
+        foreach ($boardList as $board) {
77 77
             if ($board->type == 'scrum') {
78 78
             $boards[] = $this->getSprintInfoForBoard($board->id, $paramArray);
79
-            }else {
79
+            } else {
80 80
             $boards[] = $board;
81 81
             }
82 82
         }
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
         return $boards;
87 87
     }
88 88
 
89
-    public function getSprintInfoForBoard($boardId,$paramArray) {
89
+    public function getSprintInfoForBoard($boardId, $paramArray) {
90 90
         $board = $this->getBoard($boardId);
91
-        $sprintList = $this->loopOverResults($this->uri.'/'.$boardId.'/sprint/',$paramArray);
91
+        $sprintList = $this->loopOverResults($this->uri.'/'.$boardId.'/sprint/', $paramArray);
92 92
         $sprintObjectsArray = array();
93 93
         foreach ($sprintList as $sprint) {
94 94
         $sprintObjectsArray[$sprint->id] = SprintService::getSprintFromJSON($sprint);
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
         return $board;
98 98
     }
99 99
 
100
-    public function loopOverResults($uri,$paramArray = []) {
100
+    public function loopOverResults($uri, $paramArray = []) {
101 101
         $resultsArray = array();
102 102
         $ret = $this->restClient->exec($uri.$this->restClient->toHttpQueryParameter($paramArray), null);
103 103
         $results = json_decode($ret);
104 104
         while (!$results->isLast) {
105
-            $resultsArray = array_merge($resultsArray,$results->values);
105
+            $resultsArray = array_merge($resultsArray, $results->values);
106 106
             $paramArray['startAt'] = $results->startAt + $results->maxResults;
107 107
             $ret = $this->restClient->exec($this->uri.$this->restClient->toHttpQueryParameter($paramArray), null);
108 108
             $results = json_decode($ret);
109 109
         }
110
-        $resultsArray = array_merge($resultsArray,$results->values);
110
+        $resultsArray = array_merge($resultsArray, $results->values);
111 111
         return $resultsArray;
112 112
         }
113 113
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
         foreach($boardList as $board) {
77 77
             if ($board->type == 'scrum') {
78 78
             $boards[] = $this->getSprintInfoForBoard($board->id, $paramArray);
79
-            }else {
79
+            } else {
80 80
             $boards[] = $board;
81 81
             }
82 82
         }
Please login to merge, or discard this patch.