@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | /** |
| 244 | 244 | * @param $rawResponse |
| 245 | 245 | * |
| 246 | - * @return mixed |
|
| 246 | + * @return JiraClientResponse |
|
| 247 | 247 | */ |
| 248 | 248 | public function parseResponse(ResponseInterface $rawResponse) |
| 249 | 249 | { |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | 254 | * @param $result |
| 255 | - * @param array $responseCodes |
|
| 255 | + * @param integer[] $responseCodes |
|
| 256 | 256 | * @param \Closure $callback |
| 257 | 257 | * |
| 258 | 258 | * @return mixed |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $this->json_mapper = new \JsonMapper(); |
| 64 | 64 | $this->json_mapper->bEnforceMapType = false; |
| 65 | 65 | $this->json_mapper->setLogger($log); |
| 66 | - $this->json_mapper->undefinedPropertyHandler = function ($obj, $val) { |
|
| 66 | + $this->json_mapper->undefinedPropertyHandler = function($obj, $val) { |
|
| 67 | 67 | $this->log->debug('Handle undefined property', [$val, $obj]); |
| 68 | 68 | }; |
| 69 | 69 | |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | try { |
| 106 | 106 | $this->log->info('JiraRestApi request: ', [$httpMethod, $url, $options]); |
| 107 | 107 | $response = $this->transport->request($httpMethod, $url, $options); |
| 108 | - $this->log->info('JiraRestApi response: ', [$response->getHeaders(), (string)$response->getBody()]); |
|
| 108 | + $this->log->info('JiraRestApi response: ', [$response->getHeaders(), (string) $response->getBody()]); |
|
| 109 | 109 | } catch (ConnectException $e) { |
| 110 | 110 | $this->log->critical('JiraRestApi connection exception: ', [$e->getMessage()]); |
| 111 | 111 | } catch (RequestException $e) { |
| 112 | - $this->log->error('JiraRestApi response fail with code : ' . $e->getCode(), [(string)$e->getRequest()->getBody(), $e->getRequest()->getHeaders(), (string)$e->getResponse()->getBody()]); |
|
| 112 | + $this->log->error('JiraRestApi response fail with code : ' . $e->getCode(), [(string) $e->getRequest()->getBody(), $e->getRequest()->getHeaders(), (string) $e->getResponse()->getBody()]); |
|
| 113 | 113 | $response = $e->getResponse(); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $promises = []; |
| 142 | 142 | |
| 143 | - if(!empty($filePathArray)) { |
|
| 143 | + if (!empty($filePathArray)) { |
|
| 144 | 144 | |
| 145 | 145 | foreach ($filePathArray as $filename => $filePath) { |
| 146 | 146 | // load each files separately |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | $this->log->info('JiraRestApi requestAsync: ', [Request::METHOD_POST, $url, $options]); |
| 163 | 163 | $promises[] = $this->transport |
| 164 | 164 | ->requestAsync(Request::METHOD_POST, $url, $options) |
| 165 | - ->then(function (ResponseInterface $response) { |
|
| 165 | + ->then(function(ResponseInterface $response) { |
|
| 166 | 166 | $this->log->info('JiraRestApi responseAsync: ', [$response->getHeaders(), (string) $response->getBody()]); |
| 167 | 167 | return $response; |
| 168 | - }, function (RequestException $e) { |
|
| 169 | - if($e instanceof ConnectException) { |
|
| 168 | + }, function(RequestException $e) { |
|
| 169 | + if ($e instanceof ConnectException) { |
|
| 170 | 170 | $this->log->critical('JiraRestApi connection exception: ', [$e->getMessage()]); |
| 171 | 171 | return false; |
| 172 | 172 | } else { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | { |
| 231 | 231 | $array = json_decode(json_encode($array), true); // toArray |
| 232 | 232 | |
| 233 | - $array = is_callable($callback) ? array_filter($array, $callback) : array_filter((array)$array); |
|
| 233 | + $array = is_callable($callback) ? array_filter($array, $callback) : array_filter((array) $array); |
|
| 234 | 234 | foreach ($array as &$value) { |
| 235 | 235 | if (is_array($value)) { |
| 236 | 236 | $value = call_user_func([$this, 'filterNullVariable'], $value, $callback); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * @return bool |
|
| 50 | + * @return JiraClientResponse |
|
| 51 | 51 | */ |
| 52 | 52 | public function parse() |
| 53 | 53 | { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * @return ResponseInterface |
|
| 96 | + * @return integer |
|
| 97 | 97 | */ |
| 98 | 98 | public function getCode() |
| 99 | 99 | { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | - * @return ResponseInterface |
|
| 112 | + * @return boolean |
|
| 113 | 113 | */ |
| 114 | 114 | public function hasErrors() |
| 115 | 115 | { |
@@ -123,7 +123,7 @@ |
||
| 123 | 123 | */ |
| 124 | 124 | public function setError($message) |
| 125 | 125 | { |
| 126 | - if(is_array($this->error) && isset($this->error['errorMessages'])) { |
|
| 126 | + if (is_array($this->error) && isset($this->error['errorMessages'])) { |
|
| 127 | 127 | $this->error['errorMessages'][] = $message; |
| 128 | 128 | } else { |
| 129 | 129 | $this->error = ['errorMessages' => [$message]]; |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | $result = $this->exec($this->uri); |
| 24 | 24 | |
| 25 | - return $this->extractErrors($result, [200], function () use ($result) { |
|
| 25 | + return $this->extractErrors($result, [200], function() use ($result) { |
|
| 26 | 26 | return $this->json_mapper->mapArray( |
| 27 | 27 | $result->getRawData(), new \ArrayObject(), '\JiraRestApi\Webhook\Webhook' |
| 28 | 28 | ); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $result = $this->exec($this->uri . '/' . $webhookId); |
| 41 | 41 | |
| 42 | - return $this->extractErrors($result, [200], function () use ($result) { |
|
| 42 | + return $this->extractErrors($result, [200], function() use ($result) { |
|
| 43 | 43 | return $this->json_mapper->map( |
| 44 | 44 | $result->getRawData(), new Webhook() |
| 45 | 45 | ); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $result = $this->exec($this->uri, $data, Request::METHOD_POST); |
| 59 | 59 | |
| 60 | - return $this->extractErrors($result, [201], function () use ($result) { |
|
| 60 | + return $this->extractErrors($result, [201], function() use ($result) { |
|
| 61 | 61 | return $this->json_mapper->map( |
| 62 | 62 | $result->getRawData(), new Webhook() |
| 63 | 63 | ); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $result = $this->exec($this->uri . '/' . $webhookId, null, Request::METHOD_DELETE); |
| 75 | 75 | |
| 76 | - return $this->extractErrors($result, [204], function () use ($result) { |
|
| 76 | + return $this->extractErrors($result, [204], function() use ($result) { |
|
| 77 | 77 | return $result; |
| 78 | 78 | }); |
| 79 | 79 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | if (!is_null($this->self)) { |
| 75 | 75 | $parts = explode("/", $this->self); |
| 76 | - return (int)end($parts); |
|
| 76 | + return (int) end($parts); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | return null; |
@@ -106,16 +106,16 @@ discard block |
||
| 106 | 106 | self::JIRA_USER_DELETED, |
| 107 | 107 | ]; |
| 108 | 108 | |
| 109 | - if(is_array($events)) { |
|
| 110 | - foreach($events as $event) { |
|
| 111 | - if(in_array($event, $allowed_hooks)) { |
|
| 109 | + if (is_array($events)) { |
|
| 110 | + foreach ($events as $event) { |
|
| 111 | + if (in_array($event, $allowed_hooks)) { |
|
| 112 | 112 | $this->events[] = $event; |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if(is_string($events)) { |
|
| 118 | - if(in_array($events, $allowed_hooks)) { |
|
| 117 | + if (is_string($events)) { |
|
| 118 | + if (in_array($events, $allowed_hooks)) { |
|
| 119 | 119 | $this->events[] = $events; |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | $app['jira.config'] = []; |
| 20 | 20 | |
| 21 | - $app['jira.rest.transport'] = function () use ($app) { |
|
| 21 | + $app['jira.rest.transport'] = function() use ($app) { |
|
| 22 | 22 | $cfg = $app['jira.rest.configuration']; |
| 23 | 23 | |
| 24 | 24 | return new Client([ |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | 34 | $app['jira.rest.service.builder'] = $app->protect(function($serviceName) use ($app) { |
| 35 | - if(class_exists($serviceName)) { |
|
| 35 | + if (class_exists($serviceName)) { |
|
| 36 | 36 | return new $serviceName($app['jira.rest.configuration'], $app['jira.rest.transport'], $app['logger']); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - throw new \Exception('Service ' . $serviceName .' not found'); |
|
| 39 | + throw new \Exception('Service ' . $serviceName . ' not found'); |
|
| 40 | 40 | }); |
| 41 | 41 | |
| 42 | 42 | $app['jira.rest.issue'] = function() use ($app) { |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | $app['jira.config'] = []; |
| 19 | 19 | |
| 20 | - $app['jira.rest.transport'] = $app->share(function () use ($app) { |
|
| 20 | + $app['jira.rest.transport'] = $app->share(function() use ($app) { |
|
| 21 | 21 | $cfg = $app['jira.rest.configuration']; |
| 22 | 22 | |
| 23 | 23 | return new Client([ |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | }); |
| 32 | 32 | |
| 33 | 33 | $app['jira.rest.service.builder'] = $app->protect(function($serviceName) use ($app) { |
| 34 | - if(class_exists($serviceName)) { |
|
| 34 | + if (class_exists($serviceName)) { |
|
| 35 | 35 | return new $serviceName($app['jira.rest.configuration'], $app['jira.rest.transport'], $app['logger']); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - throw new \Exception('Service ' . $serviceName .' not found'); |
|
| 38 | + throw new \Exception('Service ' . $serviceName . ' not found'); |
|
| 39 | 39 | }); |
| 40 | 40 | |
| 41 | 41 | $app['jira.rest.issue'] = $app->share(function() use ($app) { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | $result = $this->exec($this->uri . '/' . $issueIdOrKey); |
| 25 | 25 | |
| 26 | - return $this->extractErrors($result, [200], function () use ($result) { |
|
| 26 | + return $this->extractErrors($result, [200], function() use ($result) { |
|
| 27 | 27 | return $this->json_mapper->map( |
| 28 | 28 | $result->getRawData(), new Issue() |
| 29 | 29 | ); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | /** @var JiraClientResponse $result */ |
| 53 | 53 | $result = $this->exec($this->searchUri, $data, Request::METHOD_POST); |
| 54 | 54 | |
| 55 | - return $this->extractErrors($result, [200], function () use ($result) { |
|
| 55 | + return $this->extractErrors($result, [200], function() use ($result) { |
|
| 56 | 56 | return $this->json_mapper->map( |
| 57 | 57 | $result->getRawData(), new IssueSearchResult() |
| 58 | 58 | ); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $result = $this->exec($this->uri, $data, Request::METHOD_POST); |
| 76 | 76 | |
| 77 | - return $this->extractErrors($result, [201], function () use ($result) { |
|
| 77 | + return $this->extractErrors($result, [201], function() use ($result) { |
|
| 78 | 78 | return $this->json_mapper->map( |
| 79 | 79 | $result->getRawData(), new Issue() |
| 80 | 80 | ); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $result = $this->exec($this->uri . '/' . $issueIdOrKey, $data, Request::METHOD_PUT); |
| 101 | 101 | |
| 102 | - return $this->extractErrors($result, [204], function () use ($result) { |
|
| 102 | + return $this->extractErrors($result, [204], function() use ($result) { |
|
| 103 | 103 | return $result; |
| 104 | 104 | }); |
| 105 | 105 | } |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function addAttachments($issueIdOrKey, array $filePathArray) |
| 116 | 116 | { |
| 117 | - $results = $this->upload($this->uri . '/' . $issueIdOrKey .'/attachments', $filePathArray); |
|
| 117 | + $results = $this->upload($this->uri . '/' . $issueIdOrKey . '/attachments', $filePathArray); |
|
| 118 | 118 | |
| 119 | 119 | $resArr = []; |
| 120 | 120 | foreach ($results as $result) { |
| 121 | - $extracted = $this->extractErrors($result, [200], function () use ($result) { |
|
| 121 | + $extracted = $this->extractErrors($result, [200], function() use ($result) { |
|
| 122 | 122 | return $this->json_mapper->mapArray( |
| 123 | 123 | $result->getRawData(), new \ArrayObject(), '\JiraRestApi\Issue\Attachment' |
| 124 | 124 | ); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $data = $this->filterNullVariable($comment); |
| 155 | 155 | $result = $this->exec($this->uri . '/' . $issueIdOrKey . '/comment', $data, Request::METHOD_POST); |
| 156 | 156 | |
| 157 | - return $this->extractErrors($result, [201], function () use ($result) { |
|
| 157 | + return $this->extractErrors($result, [201], function() use ($result) { |
|
| 158 | 158 | return $this->json_mapper->map( |
| 159 | 159 | $result->getRawData(), new Comment() |
| 160 | 160 | ); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $result = $this->exec($this->uri . '/' . $issueIdOrKey . '/comment/' . $commentId, $data, Request::METHOD_PUT); |
| 185 | 185 | |
| 186 | - return $this->extractErrors($result, [200], function () use ($result) { |
|
| 186 | + return $this->extractErrors($result, [200], function() use ($result) { |
|
| 187 | 187 | return $this->json_mapper->map( |
| 188 | 188 | $result->getRawData(), new Comment() |
| 189 | 189 | ); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | $result = $this->exec($this->uri . '/' . $issueIdOrKey . '/transitions'); |
| 205 | 205 | |
| 206 | - return $this->extractErrors($result, [200], function () use ($result) { |
|
| 206 | + return $this->extractErrors($result, [200], function() use ($result) { |
|
| 207 | 207 | $data = $result->getRawData(); |
| 208 | 208 | return $this->json_mapper->mapArray( |
| 209 | 209 | $data['transitions'], new \ArrayObject(), '\JiraRestApi\Issue\Transition' |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | $result = $this->exec($this->uri . '/' . $issueIdOrKey . '/transitions', $data, Request::METHOD_POST); |
| 257 | 257 | |
| 258 | - return $this->extractErrors($result, [204], function () use ($result) { |
|
| 258 | + return $this->extractErrors($result, [204], function() use ($result) { |
|
| 259 | 259 | return $result; |
| 260 | 260 | }); |
| 261 | 261 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | $result = $this->exec($this->uri . '/' . $issueIdOrKey, $data, Request::METHOD_PUT); |
| 295 | 295 | |
| 296 | - return $this->extractErrors($result, [204], function () use ($result) { |
|
| 296 | + return $this->extractErrors($result, [204], function() use ($result) { |
|
| 297 | 297 | return $result; |
| 298 | 298 | }); |
| 299 | 299 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | { |
| 310 | 310 | $result = $this->exec($this->uri . '/' . $issueIdOrKey . '/worklog'); |
| 311 | 311 | |
| 312 | - return $this->extractErrors($result, [200], function () use ($result) { |
|
| 312 | + return $this->extractErrors($result, [200], function() use ($result) { |
|
| 313 | 313 | return $this->json_mapper->map( |
| 314 | 314 | $result->getRawData(), new Worklog() |
| 315 | 315 | ); |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $data['update']['labels'][]['set'] = $labels; |
| 330 | 330 | |
| 331 | 331 | $result = $this->exec($this->uri . '/' . $issueIdOrKey, $data, Request::METHOD_PUT); |
| 332 | - return $this->extractErrors($result, [204], function () use ($result) { |
|
| 332 | + return $this->extractErrors($result, [204], function() use ($result) { |
|
| 333 | 333 | return $result; |
| 334 | 334 | }); |
| 335 | 335 | } |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $data['update']['labels'][]['remove'] = $labels; |
| 348 | 348 | |
| 349 | 349 | $result = $this->exec($this->uri . '/' . $issueIdOrKey, $data, Request::METHOD_PUT); |
| 350 | - return $this->extractErrors($result, [204], function () use ($result) { |
|
| 350 | + return $this->extractErrors($result, [204], function() use ($result) { |
|
| 351 | 351 | return $result; |
| 352 | 352 | }); |
| 353 | 353 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | $result = $this->exec($this->uri); |
| 17 | 17 | |
| 18 | - return $this->extractErrors($result, [200], function () use ($result) { |
|
| 18 | + return $this->extractErrors($result, [200], function() use ($result) { |
|
| 19 | 19 | return $this->json_mapper->mapArray( |
| 20 | 20 | $result->getRawData(), new \ArrayObject(), '\JiraRestApi\Issue\IssueType' |
| 21 | 21 | ); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $result = $this->exec($this->uri . '/' . $issuetypeId); |
| 33 | 33 | |
| 34 | - return $this->extractErrors($result, [200], function () use ($result) { |
|
| 34 | + return $this->extractErrors($result, [200], function() use ($result) { |
|
| 35 | 35 | return $this->json_mapper->map( |
| 36 | 36 | $result->getRawData(), new \JiraRestApi\Issue\IssueType |
| 37 | 37 | ); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | public function setProjectKey($key) |
| 232 | 232 | { |
| 233 | - if(is_null($this->project)) { |
|
| 233 | + if (is_null($this->project)) { |
|
| 234 | 234 | $this->project = new Project(); |
| 235 | 235 | } |
| 236 | 236 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | public function setProjectId($id) |
| 243 | 243 | { |
| 244 | - if(is_null($this->project)) { |
|
| 244 | + if (is_null($this->project)) { |
|
| 245 | 245 | $this->project = new Project(); |
| 246 | 246 | } |
| 247 | 247 | |