Skip to content

Commit

Permalink
Merge pull request #304 from lesstif/analysis-0gbGnM
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
lesstif authored Mar 22, 2020
2 parents c0afb15 + 146790c commit 99eb0f2
Show file tree
Hide file tree
Showing 12 changed files with 150 additions and 69 deletions.
3 changes: 2 additions & 1 deletion src/Attachment/AttachmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public function get($id, $outDir = null, $overwrite = false, $mode = 0777, $recu
$this->log->info("Result=\n".$ret);

$attachment = $this->json_mapper->map(
json_decode($ret), new Attachment()
json_decode($ret),
new Attachment()
);

if ($outDir == null) {
Expand Down
6 changes: 4 additions & 2 deletions src/Auth/AuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public function getCurrentUser()
$ret = $this->exec($this->uri);

$user = $this->json_mapper->map(
json_decode($ret), new CurrentUser()
json_decode($ret),
new CurrentUser()
);

return $user;
Expand Down Expand Up @@ -157,7 +158,8 @@ public function login($username = null, $password = null)
]), 'POST');

$session = $this->json_mapper->map(
json_decode($ret), new AuthSession()
json_decode($ret),
new AuthSession()
);

return $session;
Expand Down
7 changes: 5 additions & 2 deletions src/Field/FieldService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public function getAllFields($fieldType = Field::BOTH)
$ret = $this->exec($this->uri, null);

$fields = $this->json_mapper->mapArray(
json_decode($ret, false), new \ArrayObject(), '\JiraRestApi\Field\Field'
json_decode($ret, false),
new \ArrayObject(),
'\JiraRestApi\Field\Field'
);

// temp array
Expand Down Expand Up @@ -85,7 +87,8 @@ public function create(Field $field)
$ret = $this->exec($this->uri, $data, 'POST');

$cf = $this->json_mapper->map(
json_decode($ret), new Field()
json_decode($ret),
new Field()
);

return $cf;
Expand Down
2 changes: 1 addition & 1 deletion src/Field/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Schema
*/
public $custom;

/** custom filed id. Ex: 10201
/** custom filed id. Ex: 10201.
* @var string
*/
public $customId;
Expand Down
9 changes: 6 additions & 3 deletions src/Group/GroupService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function get($paramArray)
$this->log->info("Result=\n".$ret);

return $this->json_mapper->map(
json_decode($ret), new Group()
json_decode($ret),
new Group()
);
}

Expand Down Expand Up @@ -77,7 +78,8 @@ public function createGroup($group)
$this->log->info("Result=\n".$ret);

$group = $this->json_mapper->map(
json_decode($ret), new Group()
json_decode($ret),
new Group()
);

return $group;
Expand All @@ -103,7 +105,8 @@ public function addUserToGroup($groupName, $userName)
$this->log->info("Result=\n".$ret);

$group = $this->json_mapper->map(
json_decode($ret), new Group()
json_decode($ret),
new Group()
);

return $group;
Expand Down
90 changes: 61 additions & 29 deletions src/Issue/IssueService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class IssueService extends \JiraRestApi\JiraClient
public function getIssueFromJSON($json)
{
$issue = $this->json_mapper->map(
$json, new Issue()
$json,
new Issue()
);

return $issue;
Expand Down Expand Up @@ -50,7 +51,8 @@ public function get($issueIdOrKey, $paramArray = [], $issueObject = null)
$this->log->info("Result=\n".$ret);

return $issue = $this->json_mapper->map(
json_decode($ret), $issueObject
json_decode($ret),
$issueObject
);
}

Expand Down Expand Up @@ -162,16 +164,21 @@ public function addAttachments($issueIdOrKey, $filePathArray)
$ret = json_decode($ret);
if (is_array($ret)) {
$tmpArr = $this->json_mapper->mapArray(
$ret, new \ArrayObject(), '\JiraRestApi\Issue\Attachment'
$ret,
new \ArrayObject(),
'\JiraRestApi\Issue\Attachment'
);

foreach ($tmpArr as $t) {
array_push($attachArr, $t);
}
} elseif (is_object($ret)) {
array_push($attachArr, $this->json_mapper->map(
$ret, new Attachment()
)
array_push(
$attachArr,
$this->json_mapper->map(
$ret,
new Attachment()
)
);
}
}
Expand Down Expand Up @@ -235,7 +242,8 @@ public function addComment($issueIdOrKey, $comment)

$this->log->debug('add comment result='.var_export($ret, true));
$comment = $this->json_mapper->map(
json_decode($ret), new Comment()
json_decode($ret),
new Comment()
);

return $comment;
Expand Down Expand Up @@ -267,7 +275,8 @@ public function updateComment($issueIdOrKey, $id, $comment)

$this->log->debug('update comment result='.var_export($ret, true));
$comment = $this->json_mapper->map(
json_decode($ret), new Comment()
json_decode($ret),
new Comment()
);

return $comment;
Expand All @@ -292,8 +301,9 @@ public function getComment($issueIdOrKey, $id)

$this->log->debug('get comment result='.var_export($ret, true));
$comment = $this->json_mapper->map(
json_decode($ret), new Comment()
);
json_decode($ret),
new Comment()
);

return $comment;
}
Expand All @@ -316,8 +326,9 @@ public function getComments($issueIdOrKey)

$this->log->debug('get comments result='.var_export($ret, true));
$comment = $this->json_mapper->map(
json_decode($ret), new Comment()
);
json_decode($ret),
new Comment()
);

return $comment;
}
Expand Down Expand Up @@ -439,7 +450,9 @@ public function getTransition($issueIdOrKey, $paramArray = [])
$data = json_encode(json_decode($ret)->transitions);

$transitions = $this->json_mapper->mapArray(
json_decode($data), new \ArrayObject(), '\JiraRestApi\Issue\Transition'
json_decode($data),
new \ArrayObject(),
'\JiraRestApi\Issue\Transition'
);

return $transitions;
Expand Down Expand Up @@ -536,11 +549,13 @@ public function search($jql, $startAt = 0, $maxResults = 15, $fields = [], $expa
$result = null;
if ($this->isRestApiV3()) {
$result = $this->json_mapper->map(
$json, new IssueSearchResultV3()
$json,
new IssueSearchResultV3()
);
} else {
$result = $this->json_mapper->map(
$json, new IssueSearchResult()
$json,
new IssueSearchResult()
);
}

Expand All @@ -563,7 +578,8 @@ public function getTimeTracking($issueIdOrKey)
$this->log->debug("getTimeTracking res=$ret\n");

$issue = $this->json_mapper->map(
json_decode($ret), new Issue()
json_decode($ret),
new Issue()
);

return $issue->fields->timeTracking;
Expand Down Expand Up @@ -614,7 +630,8 @@ public function getWorklog($issueIdOrKey)
$ret = $this->exec($this->uri."/$issueIdOrKey/worklog");
$this->log->debug("getWorklog res=$ret\n");
$worklog = $this->json_mapper->map(
json_decode($ret), new PaginatedWorklog()
json_decode($ret),
new PaginatedWorklog()
);

return $worklog;
Expand All @@ -636,7 +653,8 @@ public function getWorklogById($issueIdOrKey, $workLogId)
$ret = $this->exec($this->uri."/$issueIdOrKey/worklog/$workLogId");
$this->log->debug("getWorklogById res=$ret\n");
$worklog = $this->json_mapper->map(
json_decode($ret), new Worklog()
json_decode($ret),
new Worklog()
);

return $worklog;
Expand Down Expand Up @@ -664,7 +682,8 @@ public function addWorklog($issueIdOrKey, $worklog)
$ret = $this->exec($url, $data, $type);

$ret_worklog = $this->json_mapper->map(
json_decode($ret), new Worklog()
json_decode($ret),
new Worklog()
);

return $ret_worklog;
Expand Down Expand Up @@ -693,7 +712,8 @@ public function editWorklog($issueIdOrKey, $worklog, $worklogId)
$ret = $this->exec($url, $data, $type);

$ret_worklog = $this->json_mapper->map(
json_decode($ret), new Worklog()
json_decode($ret),
new Worklog()
);

return $ret_worklog;
Expand All @@ -718,7 +738,7 @@ public function deleteWorklog($issueIdOrKey, $worklogId)

$ret = $this->exec($url, null, $type);

return (bool)$ret;
return (bool) $ret;
}

/**
Expand All @@ -733,7 +753,9 @@ public function getAllPriorities()
$ret = $this->exec('priority', null);

$priorities = $this->json_mapper->mapArray(
json_decode($ret, false), new \ArrayObject(), '\JiraRestApi\Issue\Priority'
json_decode($ret, false),
new \ArrayObject(),
'\JiraRestApi\Issue\Priority'
);

return $priorities;
Expand All @@ -757,7 +779,8 @@ public function getPriority($priorityId)
$this->log->info('Result='.$ret);

$prio = $this->json_mapper->map(
json_decode($ret), new Priority()
json_decode($ret),
new Priority()
);

return $prio;
Expand All @@ -781,7 +804,8 @@ public function getCustomFields($priorityId)
$this->log->info('Result='.$ret);

$prio = $this->json_mapper->map(
json_decode($ret), new Priority()
json_decode($ret),
new Priority()
);

return $prio;
Expand All @@ -805,7 +829,9 @@ public function getWatchers($issueIdOrKey)
$ret = $this->exec($url, null);

$watchers = $this->json_mapper->mapArray(
json_decode($ret, false)->watchers, new \ArrayObject(), '\JiraRestApi\Issue\Reporter'
json_decode($ret, false)->watchers,
new \ArrayObject(),
'\JiraRestApi\Issue\Reporter'
);

return $watchers;
Expand Down Expand Up @@ -987,7 +1013,9 @@ public function getRemoteIssueLink($issueIdOrKey)
$ret = $this->exec($full_uri, null);

$rils = $this->json_mapper->mapArray(
json_decode($ret, false), new \ArrayObject(), RemoteIssueLink::class
json_decode($ret, false),
new \ArrayObject(),
RemoteIssueLink::class
);

return $rils;
Expand All @@ -1013,7 +1041,8 @@ public function createOrUpdateRemoteIssueLink($issueIdOrKey, RemoteIssueLink $ri
$ret = $this->exec($full_uri, $data, 'POST');

$res = $this->json_mapper->map(
json_decode($ret), new RemoteIssueLink()
json_decode($ret),
new RemoteIssueLink()
);

return $res;
Expand Down Expand Up @@ -1067,7 +1096,9 @@ public function getAllIssueSecuritySchemes()
$schemes = json_decode(json_encode($data['issueSecuritySchemes']), false);

$res = $this->json_mapper->mapArray(
$schemes, new \ArrayObject(), '\JiraRestApi\Issue\SecurityScheme'
$schemes,
new \ArrayObject(),
'\JiraRestApi\Issue\SecurityScheme'
);

return $res;
Expand All @@ -1090,7 +1121,8 @@ public function getIssueSecuritySchemes($securityId)
$ret = $this->exec($url);

$res = $this->json_mapper->map(
json_decode($ret), new SecurityScheme()
json_decode($ret),
new SecurityScheme()
);

return $res;
Expand Down
18 changes: 12 additions & 6 deletions src/Issue/JqlQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,10 @@ public function addAnyExpression($expression)
*/
public function addExpression($field, $operator, $value, $logicLinkKeyword = self::KEYWORD_AND)
{
$this->joinExpression(self::quoteField($field)." $operator ".self::quote($value),
$logicLinkKeyword);
$this->joinExpression(
self::quoteField($field)." $operator ".self::quote($value),
$logicLinkKeyword
);

return $this;
}
Expand All @@ -563,8 +565,10 @@ public function addInExpression($field, $values, $logicLinkKeyword = self::KEYWO
foreach ($values as $value) {
$valuesQuoted[] = self::quote($value);
}
$this->joinExpression(self::quoteField($field).' in ('.implode(', ', $valuesQuoted).')',
$logicLinkKeyword);
$this->joinExpression(
self::quoteField($field).' in ('.implode(', ', $valuesQuoted).')',
$logicLinkKeyword
);

return $this;
}
Expand All @@ -587,8 +591,10 @@ public function addNotInExpression($field, $values, $logicLinkKeyword = self::KE
foreach ($values as $value) {
$valuesQuoted[] = self::quote($value);
}
$this->joinExpression(self::quoteField($field).' not in ('.implode(', ', $valuesQuoted).')',
$logicLinkKeyword);
$this->joinExpression(
self::quoteField($field).' not in ('.implode(', ', $valuesQuoted).')',
$logicLinkKeyword
);

return $this;
}
Expand Down
4 changes: 3 additions & 1 deletion src/IssueLink/IssueLinkService.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public function getIssueLinkTypes()
$data = json_encode(json_decode($ret)->issueLinkTypes);

$linkTypes = $this->json_mapper->mapArray(
json_decode($data, false), new \ArrayObject(), '\JiraRestApi\IssueLink\IssueLinkType'
json_decode($data, false),
new \ArrayObject(),
'\JiraRestApi\IssueLink\IssueLinkType'
);

return $linkTypes;
Expand Down
Loading

0 comments on commit 99eb0f2

Please sign in to comment.