From 00bc830a49e82d98b511d9ce0d38b5567216af86 Mon Sep 17 00:00:00 2001 From: Oleksiy Kalinichenko Date: Mon, 31 Dec 2018 12:32:25 +0200 Subject: [PATCH 1/3] The "JiraClient::__construct()" gets "LoggerInterface" --- src/JiraClient.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/JiraClient.php b/src/JiraClient.php index 2b7af31d..378d5b1b 100644 --- a/src/JiraClient.php +++ b/src/JiraClient.php @@ -4,6 +4,7 @@ use JiraRestApi\Configuration\ConfigurationInterface; use JiraRestApi\Configuration\DotEnvConfiguration; +use Psr\Log\LoggerInterface; use Monolog\Handler\StreamHandler; use Monolog\Logger as Logger; @@ -64,7 +65,7 @@ class JiraClient * @throws JiraException * @throws \Exception */ - public function __construct(ConfigurationInterface $configuration = null, Logger $logger = null, $path = './') + public function __construct(ConfigurationInterface $configuration = null, LoggerInterface $logger = null, $path = './') { if ($configuration === null) { if (!file_exists($path.'.env')) { From d099bf66af2d74c18fc51f4f1107468571f7d8c4 Mon Sep 17 00:00:00 2001 From: Oleksiy Kalinichenko Date: Mon, 31 Dec 2018 12:38:17 +0200 Subject: [PATCH 2/3] Update JiraClient.php Improve code regarding https://github.styleci.io/analyses/8LVlQ6?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link --- src/JiraClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JiraClient.php b/src/JiraClient.php index 378d5b1b..0dcfe608 100644 --- a/src/JiraClient.php +++ b/src/JiraClient.php @@ -4,9 +4,9 @@ use JiraRestApi\Configuration\ConfigurationInterface; use JiraRestApi\Configuration\DotEnvConfiguration; -use Psr\Log\LoggerInterface; use Monolog\Handler\StreamHandler; use Monolog\Logger as Logger; +use Psr\Log\LoggerInterface; /** * Interact jira server with REST API. From 294c42b4278a50ab93fbb7fa10b3109e295b13b0 Mon Sep 17 00:00:00 2001 From: Oleksiy Kalinichenko Date: Mon, 31 Dec 2018 16:10:49 +0200 Subject: [PATCH 3/3] #225: Replace "addXxxx()" methods of Monolog with "xxxx()" of "Psr\Log\LoggerInterface". --- src/Attachment/AttachmentService.php | 4 +- src/Field/FieldService.php | 4 +- src/Group/GroupService.php | 10 ++-- src/Issue/IssueService.php | 80 ++++++++++++++-------------- src/IssueLink/IssueLinkService.php | 6 +-- src/JiraClient.php | 28 +++++----- src/Priority/PriorityService.php | 4 +- src/Project/ProjectService.php | 18 +++---- src/Sprint/SprintService.php | 2 +- src/User/UserService.php | 8 +-- src/Version/VersionService.php | 4 +- 11 files changed, 84 insertions(+), 84 deletions(-) diff --git a/src/Attachment/AttachmentService.php b/src/Attachment/AttachmentService.php index a8a97ede..9e12664e 100644 --- a/src/Attachment/AttachmentService.php +++ b/src/Attachment/AttachmentService.php @@ -29,7 +29,7 @@ public function get($id, $outDir = null, $overwrite = false, $mode = 0777, $recu { $ret = $this->exec($this->uri.$id, null); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); $attachment = $this->json_mapper->map( json_decode($ret), new Attachment() @@ -69,7 +69,7 @@ public function remove($id) { $ret = $this->exec($this->uri.$id, null, 'DELETE'); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); return $ret; } diff --git a/src/Field/FieldService.php b/src/Field/FieldService.php index e8bcd227..719c88a3 100644 --- a/src/Field/FieldService.php +++ b/src/Field/FieldService.php @@ -61,7 +61,7 @@ public function getCustomFieldOption($id) { $ret = $this->exec('/customFieldOption/'.$id); - $this->log->addDebug("get custom Field Option=\n".$ret); + $this->log->debug("get custom Field Option=\n".$ret); return $ret; } @@ -80,7 +80,7 @@ public function create(Field $field) { $data = json_encode($field); - $this->log->addInfo("Create Field=\n".$data); + $this->log->info("Create Field=\n".$data); $ret = $this->exec($this->uri, $data, 'POST'); diff --git a/src/Group/GroupService.php b/src/Group/GroupService.php index 63f3d227..0868fa95 100644 --- a/src/Group/GroupService.php +++ b/src/Group/GroupService.php @@ -26,7 +26,7 @@ public function get($paramArray) $ret = $this->exec($this->uri.$queryParam, null); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); return $this->json_mapper->map( json_decode($ret), new Group() @@ -49,7 +49,7 @@ public function getMembers($paramArray) $ret = $this->exec($this->uri.'/member'.$queryParam, null); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); $userData = json_decode($ret); @@ -74,7 +74,7 @@ public function createGroup($group) $ret = $this->exec($this->uri, $data); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); $group = $this->json_mapper->map( json_decode($ret), new Group() @@ -100,7 +100,7 @@ public function addUserToGroup($groupName, $userName) $ret = $this->exec($this->uri.'/user?groupname='.urlencode($groupName), $data); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); $group = $this->json_mapper->map( json_decode($ret), new Group() @@ -125,7 +125,7 @@ public function removeUserFromGroup($groupName, $userName) $ret = $this->exec($this->uri.'/user?'.$param, [], 'DELETE'); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); return $ret; } diff --git a/src/Issue/IssueService.php b/src/Issue/IssueService.php index 686fb58e..7367691e 100644 --- a/src/Issue/IssueService.php +++ b/src/Issue/IssueService.php @@ -42,7 +42,7 @@ public function get($issueIdOrKey, $paramArray = [], $issueObject = null) $ret = $this->exec($this->uri.'/'.$issueIdOrKey.$this->toHttpQueryParameter($paramArray), null); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); return $issue = $this->json_mapper->map( json_decode($ret), $issueObject @@ -68,7 +68,7 @@ public function create($issueField) $data = json_encode($issue); - $this->log->addInfo("Create Issue=\n".$data); + $this->log->info("Create Issue=\n".$data); $ret = $this->exec($this->uri, $data, 'POST'); @@ -120,7 +120,7 @@ private function bulkInsert($issues) { $data = json_encode(['issueUpdates' => $issues]); - $this->log->addInfo("Create Issues=\n".$data); + $this->log->info("Create Issues=\n".$data); $results = $this->exec($this->uri.'/bulk', $data, 'POST'); $issues = []; @@ -150,7 +150,7 @@ public function addAttachments($issueIdOrKey, $filePathArray) $results = $this->upload($this->uri."/$issueIdOrKey/attachments", $filePathArray); - $this->log->addInfo('addAttachments result='.var_export($results, true)); + $this->log->info('addAttachments result='.var_export($results, true)); $attachArr = []; foreach ($results as $ret) { @@ -196,7 +196,7 @@ public function update($issueIdOrKey, $issueField, $paramArray = []) $data = json_encode($issue); - $this->log->addInfo("Update Issue=\n".$data); + $this->log->info("Update Issue=\n".$data); $queryParam = '?'.http_build_query($paramArray); @@ -218,13 +218,13 @@ public function update($issueIdOrKey, $issueField, $paramArray = []) */ public function addComment($issueIdOrKey, $comment) { - $this->log->addInfo("addComment=\n"); + $this->log->info("addComment=\n"); $data = json_encode($comment); $ret = $this->exec($this->uri."/$issueIdOrKey/comment", $data); - $this->log->addDebug('add comment result='.var_export($ret, true)); + $this->log->debug('add comment result='.var_export($ret, true)); $comment = $this->json_mapper->map( json_decode($ret), new Comment() ); @@ -246,13 +246,13 @@ public function addComment($issueIdOrKey, $comment) */ public function updateComment($issueIdOrKey, $id, $comment) { - $this->log->addInfo("updateComment=\n"); + $this->log->info("updateComment=\n"); $data = json_encode($comment); $ret = $this->exec($this->uri."/$issueIdOrKey/comment/$id", $data, 'PUT'); - $this->log->addDebug('update comment result='.var_export($ret, true)); + $this->log->debug('update comment result='.var_export($ret, true)); $comment = $this->json_mapper->map( json_decode($ret), new Comment() ); @@ -273,11 +273,11 @@ public function updateComment($issueIdOrKey, $id, $comment) */ public function getComment($issueIdOrKey, $id) { - $this->log->addInfo("getComment=\n"); + $this->log->info("getComment=\n"); $ret = $this->exec($this->uri."/$issueIdOrKey/comment/$id"); - $this->log->addDebug('get comment result='.var_export($ret, true)); + $this->log->debug('get comment result='.var_export($ret, true)); $comment = $this->json_mapper->map( json_decode($ret), new Comment() ); @@ -297,11 +297,11 @@ public function getComment($issueIdOrKey, $id) */ public function getComments($issueIdOrKey) { - $this->log->addInfo("getComments=\n"); + $this->log->info("getComments=\n"); $ret = $this->exec($this->uri."/$issueIdOrKey/comment"); - $this->log->addDebug('get comments result='.var_export($ret, true)); + $this->log->debug('get comments result='.var_export($ret, true)); $comment = $this->json_mapper->map( json_decode($ret), new Comment() ); @@ -321,11 +321,11 @@ public function getComments($issueIdOrKey) */ public function deleteComment($issueIdOrKey, $id) { - $this->log->addInfo("deleteComment=\n"); + $this->log->info("deleteComment=\n"); $ret = $this->exec($this->uri."/$issueIdOrKey/comment/$id", '', 'DELETE'); - $this->log->addInfo('delete comment '.$issueIdOrKey.' '.$id.' result='.var_export($ret, true)); + $this->log->info('delete comment '.$issueIdOrKey.' '.$id.' result='.var_export($ret, true)); return $ret; } @@ -344,7 +344,7 @@ public function deleteComment($issueIdOrKey, $id) */ public function changeAssignee($issueIdOrKey, $assigneeName) { - $this->log->addInfo("changeAssignee=\n"); + $this->log->info("changeAssignee=\n"); $ar = ['name' => $assigneeName]; @@ -352,7 +352,7 @@ public function changeAssignee($issueIdOrKey, $assigneeName) $ret = $this->exec($this->uri."/$issueIdOrKey/assignee", $data, 'PUT'); - $this->log->addInfo('change assignee of '.$issueIdOrKey.' to '.$assigneeName.' result='.var_export($ret, true)); + $this->log->info('change assignee of '.$issueIdOrKey.' to '.$assigneeName.' result='.var_export($ret, true)); return $ret; } @@ -369,13 +369,13 @@ public function changeAssignee($issueIdOrKey, $assigneeName) */ public function deleteIssue($issueIdOrKey, $paramArray = []) { - $this->log->addInfo("deleteIssue=\n"); + $this->log->info("deleteIssue=\n"); $queryParam = '?'.http_build_query($paramArray); $ret = $this->exec($this->uri."/$issueIdOrKey".$queryParam, '', 'DELETE'); - $this->log->addInfo('delete issue '.$issueIdOrKey.' result='.var_export($ret, true)); + $this->log->info('delete issue '.$issueIdOrKey.' result='.var_export($ret, true)); return $ret; } @@ -393,7 +393,7 @@ public function getTransition($issueIdOrKey) { $ret = $this->exec($this->uri."/$issueIdOrKey/transitions"); - $this->log->addDebug('getTransitions result='.var_export($ret, true)); + $this->log->debug('getTransitions result='.var_export($ret, true)); $data = json_encode(json_decode($ret)->transitions); @@ -416,14 +416,14 @@ public function getTransition($issueIdOrKey) */ public function findTransitonId($issueIdOrKey, $transitionToName) { - $this->log->addDebug('findTransitonId='); + $this->log->debug('findTransitonId='); $ret = $this->getTransition($issueIdOrKey); foreach ($ret as $trans) { $toName = $trans->to->name; - $this->log->addDebug('getTransitions result='.var_export($ret, true)); + $this->log->debug('getTransitions result='.var_export($ret, true)); if (strcmp($toName, $transitionToName) == 0) { return $trans->id; @@ -446,7 +446,7 @@ public function findTransitonId($issueIdOrKey, $transitionToName) */ public function transition($issueIdOrKey, $transition) { - $this->log->addDebug('transition='.var_export($transition, true)); + $this->log->debug('transition='.var_export($transition, true)); if (!isset($transition->transition['id'])) { $transition->transition['id'] = $this->findTransitonId($issueIdOrKey, $transition->transition['name']); @@ -454,11 +454,11 @@ public function transition($issueIdOrKey, $transition) $data = json_encode($transition); - $this->log->addDebug("transition req=$data\n"); + $this->log->debug("transition req=$data\n"); $ret = $this->exec($this->uri."/$issueIdOrKey/transitions", $data, 'POST'); - $this->log->addDebug('getTransitions result='.var_export($ret, true)); + $this->log->debug('getTransitions result='.var_export($ret, true)); return $ret; } @@ -512,7 +512,7 @@ public function search($jql, $startAt = 0, $maxResults = 15, $fields = [], $expa public function getTimeTracking($issueIdOrKey) { $ret = $this->exec($this->uri."/$issueIdOrKey", null); - $this->log->addDebug("getTimeTracking res=$ret\n"); + $this->log->debug("getTimeTracking res=$ret\n"); $issue = $this->json_mapper->map( json_decode($ret), new Issue() @@ -543,7 +543,7 @@ public function timeTracking($issueIdOrKey, $timeTracking) $data = json_encode($array); - $this->log->addDebug("TimeTracking req=$data\n"); + $this->log->debug("TimeTracking req=$data\n"); // if success, just return HTTP 201. $ret = $this->exec($this->uri."/$issueIdOrKey", $data, 'PUT'); @@ -564,7 +564,7 @@ public function timeTracking($issueIdOrKey, $timeTracking) public function getWorklog($issueIdOrKey) { $ret = $this->exec($this->uri."/$issueIdOrKey/worklog"); - $this->log->addDebug("getWorklog res=$ret\n"); + $this->log->debug("getWorklog res=$ret\n"); $worklog = $this->json_mapper->map( json_decode($ret), new PaginatedWorklog() ); @@ -586,7 +586,7 @@ public function getWorklog($issueIdOrKey) public function getWorklogById($issueIdOrKey, $workLogId) { $ret = $this->exec($this->uri."/$issueIdOrKey/worklog/$workLogId"); - $this->log->addDebug("getWorklogById res=$ret\n"); + $this->log->debug("getWorklogById res=$ret\n"); $worklog = $this->json_mapper->map( json_decode($ret), new Worklog() ); @@ -607,7 +607,7 @@ public function getWorklogById($issueIdOrKey, $workLogId) */ public function addWorklog($issueIdOrKey, $worklog) { - $this->log->addInfo("addWorklog=\n"); + $this->log->info("addWorklog=\n"); $data = json_encode($worklog); $url = $this->uri."/$issueIdOrKey/worklog"; @@ -636,7 +636,7 @@ public function addWorklog($issueIdOrKey, $worklog) */ public function editWorklog($issueIdOrKey, $worklog, $worklogId) { - $this->log->addInfo("editWorklog=\n"); + $this->log->info("editWorklog=\n"); $data = json_encode($worklog); $url = $this->uri."/$issueIdOrKey/worklog/$worklogId"; @@ -684,7 +684,7 @@ public function getPriority($priorityId) { $ret = $this->exec("priority/$priorityId", null); - $this->log->addInfo('Result='.$ret); + $this->log->info('Result='.$ret); $prio = $this->json_mapper->map( json_decode($ret), new Priority() @@ -708,7 +708,7 @@ public function getCustomFields($priorityId) { $ret = $this->exec("priority/$priorityId", null); - $this->log->addInfo('Result='.$ret); + $this->log->info('Result='.$ret); $prio = $this->json_mapper->map( json_decode($ret), new Priority() @@ -728,7 +728,7 @@ public function getCustomFields($priorityId) */ public function getWatchers($issueIdOrKey) { - $this->log->addInfo("getWatchers=\n"); + $this->log->info("getWatchers=\n"); $url = $this->uri."/$issueIdOrKey/watchers"; @@ -753,7 +753,7 @@ public function getWatchers($issueIdOrKey) */ public function addWatcher($issueIdOrKey, $watcher) { - $this->log->addInfo("addWatcher=\n"); + $this->log->info("addWatcher=\n"); $data = json_encode($watcher); $url = $this->uri."/$issueIdOrKey/watchers"; @@ -847,7 +847,7 @@ public function notify($issueIdOrKey, $notify) $data = json_encode($notify, JSON_UNESCAPED_SLASHES); - $this->log->addDebug("notify=$data\n"); + $this->log->debug("notify=$data\n"); $ret = $this->exec($full_uri, $data, 'POST'); @@ -896,7 +896,7 @@ public function createOrUpdateRemoteIssueLink($issueIdOrKey, RemoteIssueLink $ri $data = json_encode($ril, JSON_UNESCAPED_SLASHES); - $this->log->addDebug("create remoteIssueLink=$data\n"); + $this->log->debug("create remoteIssueLink=$data\n"); $ret = $this->exec($full_uri, $data, 'POST'); @@ -923,7 +923,7 @@ public function removeRemoteIssueLink($issueIdOrKey, $globalId) $ret = $this->exec($full_uri, '', 'DELETE'); - $this->log->addInfo( + $this->log->info( sprintf( 'delete remote issue link for issue "%s" with globalId "%s". Result=%s', $issueIdOrKey, @@ -1013,7 +1013,7 @@ public function updateLabels($issueIdOrKey, $addLablesParam, $removeLabelsParam, ], ], JSON_UNESCAPED_UNICODE); - $this->log->addInfo("Update labels=\n".$postData); + $this->log->info("Update labels=\n".$postData); $queryParam = '?'.http_build_query(['notifyUsers' => $notifyUsers]); @@ -1051,7 +1051,7 @@ public function updateFixVersions($issueIdOrKey, $addFixVersionsParam, $removeFi ], ], JSON_UNESCAPED_UNICODE); - $this->log->addInfo("Update fixVersions=\n".$postData); + $this->log->info("Update fixVersions=\n".$postData); $queryParam = '?'.http_build_query(['notifyUsers' => $notifyUsers]); diff --git a/src/IssueLink/IssueLinkService.php b/src/IssueLink/IssueLinkService.php index 9b1092c6..b8322cb7 100644 --- a/src/IssueLink/IssueLinkService.php +++ b/src/IssueLink/IssueLinkService.php @@ -13,11 +13,11 @@ class IssueLinkService extends \JiraRestApi\JiraClient */ public function addIssueLink($issueLink) { - $this->log->addInfo("addIssueLink=\n"); + $this->log->info("addIssueLink=\n"); $data = json_encode($issueLink); - $this->log->addDebug("Create IssueLink=\n".$data); + $this->log->debug("Create IssueLink=\n".$data); $url = $this->uri.'/issueLink'; $type = 'POST'; @@ -32,7 +32,7 @@ public function addIssueLink($issueLink) */ public function getIssueLinkTypes() { - $this->log->addInfo("getIssueLinkTYpes=\n"); + $this->log->info("getIssueLinkTYpes=\n"); $url = $this->uri.'/issueLinkType'; diff --git a/src/JiraClient.php b/src/JiraClient.php index 0dcfe608..3fed04c9 100644 --- a/src/JiraClient.php +++ b/src/JiraClient.php @@ -173,9 +173,9 @@ public function exec($context, $post_data = null, $custom_request = null, $cooki $url = $this->createUrlByContext($context); if (is_string($post_data)) { - $this->log->addInfo("Curl $custom_request: $url JsonData=".$post_data); + $this->log->info("Curl $custom_request: $url JsonData=".$post_data); } elseif (is_array($post_data)) { - $this->log->addInfo("Curl $custom_request: $url JsonData=".json_encode($post_data, JSON_UNESCAPED_UNICODE)); + $this->log->info("Curl $custom_request: $url JsonData=".json_encode($post_data, JSON_UNESCAPED_UNICODE)); } $ch = curl_init(); @@ -228,7 +228,7 @@ public function exec($context, $post_data = null, $custom_request = null, $cooki curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$username:$password"); } - $this->log->addDebug('Curl exec='.$url); + $this->log->debug('Curl exec='.$url); $response = curl_exec($ch); // if request failed or have no result. @@ -248,7 +248,7 @@ public function exec($context, $post_data = null, $custom_request = null, $cooki // HostNotFound, No route to Host, etc Network error $msg = sprintf('CURL Error: http response=%d, %s', $this->http_response, $body); - $this->log->addError($msg); + $this->log->error($msg); throw new JiraException($msg); } else { @@ -292,7 +292,7 @@ private function createUploadHandle($url, $upload_file) curl_setopt($ch, CURLOPT_POSTFIELDS, ['file' => '@'.$attachments.';filename='.$filename]); - $this->log->addDebug('using legacy file upload'); + $this->log->debug('using legacy file upload'); } else { // CURLFile require PHP > 5.5 $attachments = new \CURLFile(realpath($upload_file)); @@ -301,7 +301,7 @@ private function createUploadHandle($url, $upload_file) curl_setopt($ch, CURLOPT_POSTFIELDS, ['file' => $attachments]); - $this->log->addDebug('using CURLFile='.var_export($attachments, true)); + $this->log->debug('using CURLFile='.var_export($attachments, true)); } $this->authorization($ch); @@ -321,7 +321,7 @@ private function createUploadHandle($url, $upload_file) curl_setopt($ch, CURLOPT_VERBOSE, $this->getConfiguration()->isCurlOptVerbose()); - $this->log->addDebug('Curl exec='.$url); + $this->log->debug('Curl exec='.$url); return $ch; } @@ -386,7 +386,7 @@ public function upload($context, $filePathArray) // HostNotFound, No route to Host, etc Network error $result_code = -1; $body = 'CURL Error: = '.$body; - $this->log->addError($body); + $this->log->error($body); } else { // if request was ok, parsing http response code. $result_code = $this->http_response = curl_getinfo($ch, CURLINFO_HTTP_CODE); @@ -396,7 +396,7 @@ public function upload($context, $filePathArray) $body = 'CURL HTTP Request Failed: Status Code : ' .$this->http_response.', URL:'.$url; - $this->log->addError($body); + $this->log->error($body); } } } @@ -417,11 +417,11 @@ public function upload($context, $filePathArray) protected function closeCURLHandle(array $chArr, $mh, $body, $result_code) { foreach ($chArr as $ch) { - $this->log->addDebug('CURL Close handle..'); + $this->log->debug('CURL Close handle..'); curl_multi_remove_handle($mh, $ch); curl_close($ch); } - $this->log->addDebug('CURL Multi Close handle..'); + $this->log->debug('CURL Multi Close handle..'); curl_multi_close($mh); if ($result_code != 200) { // @TODO $body might have not been defined @@ -459,7 +459,7 @@ protected function authorization($ch, $cookieFile = null) curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile); - $this->log->addDebug('Using cookie..'); + $this->log->debug('Using cookie..'); } // if cookie file not exist, using id/pwd login @@ -555,7 +555,7 @@ public function download($url, $outDir, $file, $cookieFile = null) curl_setopt($ch, CURLOPT_VERBOSE, $this->getConfiguration()->isCurlOptVerbose()); - $this->log->addDebug('Curl exec='.$url); + $this->log->debug('Curl exec='.$url); $response = curl_exec($ch); // if request failed. @@ -576,7 +576,7 @@ public function download($url, $outDir, $file, $cookieFile = null) // HostNotFound, No route to Host, etc Network error $msg = sprintf('CURL Error: http response=%d, %s', $this->http_response, $body); - $this->log->addError($msg); + $this->log->error($msg); throw new JiraException($msg); } else { diff --git a/src/Priority/PriorityService.php b/src/Priority/PriorityService.php index d385c5db..83d99879 100644 --- a/src/Priority/PriorityService.php +++ b/src/Priority/PriorityService.php @@ -23,7 +23,7 @@ public function getAll() { $ret = $this->exec($this->uri, null); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); $priorityData = json_decode($ret); $priorities = []; @@ -49,7 +49,7 @@ public function get($priorityId) { $ret = $this->exec($this->uri."/$priorityId", null); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); $priority = $this->json_mapper->map(json_decode($ret), new Priority()); diff --git a/src/Project/ProjectService.php b/src/Project/ProjectService.php index 157d4959..ae1dfe30 100644 --- a/src/Project/ProjectService.php +++ b/src/Project/ProjectService.php @@ -46,7 +46,7 @@ public function get($projectIdOrKey) { $ret = $this->exec($this->uri."/$projectIdOrKey", null); - $this->log->addInfo('Result='.$ret); + $this->log->info('Result='.$ret); $prj = $this->json_mapper->map( json_decode($ret), new Project() @@ -103,7 +103,7 @@ public function getProjectTypes() { $ret = $this->exec($this->uri.'/type'); - $this->log->addInfo('Result='.$ret); + $this->log->info('Result='.$ret); $json = json_decode($ret); $results = array_map(function ($elem) { @@ -125,7 +125,7 @@ public function getProjectType($key) { $ret = $this->exec($this->uri."/type/$key"); - $this->log->addInfo('Result='.$ret); + $this->log->info('Result='.$ret); $type = $this->json_mapper->map( json_decode($ret, false), new ProjectType() @@ -146,7 +146,7 @@ public function getAccessibleProjectType($key) { $ret = $this->exec($this->uri."/type/$key/accessible"); - $this->log->addInfo('Result='.$ret); + $this->log->info('Result='.$ret); $type = $this->json_mapper->map( json_decode($ret, false), new ProjectType() @@ -181,7 +181,7 @@ public function getVersionsPagenated($projectIdOrKey, $queryParam = []) $ret = $this->exec($this->uri."/$projectIdOrKey/version".$param); - $this->log->addInfo('Result='.$ret); + $this->log->info('Result='.$ret); //@see https://docs.atlassian.com/jira/REST/server/#api/2/project-getProjectVersions $json = json_decode($ret); @@ -206,7 +206,7 @@ public function getVersions($projectIdOrKey) { $ret = $this->exec($this->uri."/$projectIdOrKey/versions"); - $this->log->addInfo('Result='.$ret); + $this->log->info('Result='.$ret); $versions = $this->json_mapper->mapArray( json_decode($ret, false), new \ArrayObject(), '\JiraRestApi\Issue\Version' @@ -229,7 +229,7 @@ public function getVersion($projectIdOrKey, $versionName) { $ret = $this->exec($this->uri."/$projectIdOrKey/versions"); - $this->log->addInfo('Result='.$ret); + $this->log->info('Result='.$ret); $versions = $this->json_mapper->mapArray( json_decode($ret, false), new \ArrayObject(), '\JiraRestApi\Issue\Version' @@ -259,7 +259,7 @@ public function createProject($project) $ret = $this->exec($this->uri, $data, 'POST'); - $this->log->addInfo('createProject Result='.$ret); + $this->log->info('createProject Result='.$ret); return $this->json_mapper->map( json_decode($ret), new Project() @@ -285,7 +285,7 @@ public function updateProject($project, $projectIdOrKey) $ret = $this->exec($this->uri.'/'.$projectIdOrKey, $data, 'PUT'); - $this->log->addInfo('updateProject Result='.$ret); + $this->log->info('updateProject Result='.$ret); return $this->json_mapper->map( json_decode($ret), new Project() diff --git a/src/Sprint/SprintService.php b/src/Sprint/SprintService.php index c21278f3..f50a173b 100644 --- a/src/Sprint/SprintService.php +++ b/src/Sprint/SprintService.php @@ -47,7 +47,7 @@ public function getSprint($sprintId) { $ret = $this->exec($this->uri.'/'.$sprintId, null); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); return $sprint = $this->json_mapper->map( json_decode($ret), new Sprint() diff --git a/src/User/UserService.php b/src/User/UserService.php index 42f9f899..218e65ff 100644 --- a/src/User/UserService.php +++ b/src/User/UserService.php @@ -25,7 +25,7 @@ public function create($user) { $data = json_encode($user); - $this->log->addInfo("Create User=\n".$data); + $this->log->info("Create User=\n".$data); $ret = $this->exec($this->uri, $data, 'POST'); @@ -51,7 +51,7 @@ public function get($paramArray) $ret = $this->exec($this->uri.$queryParam, null); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); return $this->json_mapper->map( json_decode($ret), new User() @@ -74,7 +74,7 @@ public function findUsers($paramArray) $ret = $this->exec($this->uri.'/search'.$queryParam, null); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); $userData = json_decode($ret); $users = []; @@ -107,7 +107,7 @@ public function findAssignableUsers($paramArray) $ret = $this->exec($this->uri.'/assignable/search'.$queryParam, null); - $this->log->addInfo("Result=\n".$ret); + $this->log->info("Result=\n".$ret); $userData = json_decode($ret); $users = []; diff --git a/src/Version/VersionService.php b/src/Version/VersionService.php index 716913a6..8f23cf36 100644 --- a/src/Version/VersionService.php +++ b/src/Version/VersionService.php @@ -29,7 +29,7 @@ public function create($version) } $data = json_encode($version); - $this->log->addInfo("Create Version=\n".$data); + $this->log->info("Create Version=\n".$data); $ret = $this->exec($this->uri, $data, 'POST'); @@ -63,7 +63,7 @@ public function get($id) { $ret = $this->exec($this->uri.'/'.$id); - $this->log->addInfo('Result='.$ret); + $this->log->info('Result='.$ret); $json = json_decode($ret); $results = array_map(function ($elem) {