Failed Conditions
Push — master ( 5433f0...117895 )
by Alexander
01:52
created

BackportableIssueCloner::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * This file is part of the Jira-CLI library.
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 *
7
 * @copyright Alexander Obuhovich <[email protected]>
8
 * @link      https://github.com/console-helpers/jira-cli
9
 */
10
11
namespace ConsoleHelpers\JiraCLI\Issue;
12
13
14
use chobie\Jira\Api;
15
use chobie\Jira\Issue;
16
17
class BackportableIssueCloner extends IssueCloner
18
{
19
20
	/**
21
	 * IssueCloner constructor.
22
	 *
23
	 * @param Api $jira_api Jira REST client.
24
	 */
25
	public function __construct(Api $jira_api)
26
	{
27
		parent::__construct($jira_api);
28
29
		$this->queryFields[] = 'status';
30
		$this->queryFields[] = 'components';
31
	}
32
33
	/**
34
	 * Determines if link was already processed.
35
	 *
36
	 * @param Issue $issue        Issue.
37
	 * @param Issue $linked_issue Linked issue.
38
	 *
39
	 * @return boolean
40
	 */
41
	protected function isAlreadyProcessed(Issue $issue, Issue $linked_issue)
42
	{
43
		$issue_status = $this->getIssueStatusName($issue);
44
		$linked_issue_status = $this->getIssueStatusName($linked_issue);
45
46
		return $issue_status === 'Resolved' && $linked_issue_status === 'Resolved';
47
	}
48
49
}
50