Completed
Push — add/summarise-dependencies ( 160304 )
by
unknown
140:30 queued 132:04
created

Dependency::to_csv_array()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
namespace Automattic\Jetpack\Analyzer\Dependencies;
4
5
use Automattic\Jetpack\Analyzer\PersistentList\Item as PersistentListItem;
6
7
class Dependency extends PersistentListItem {
8
	public $invocation;
9
	public $declaration;
10
	public $invocation_root;
11
12
	function __construct( $invocation, $declaration, $invocation_root = null ) {
13
		$this->invocation = $invocation;
14
		$this->declaration = $declaration;
15
		$this->invocation_root = $invocation_root;
16
	}
17
18
	// /**
19
	//  * This key is used to identify unique issues (e.g. Jetpack_Options has moved) across multiple invocations
20
	//  */
21
	// function unique_issue_key() {
22
	// 	return $this->type . ',' . $this->old_declaration->path . ',' . $this->old_declaration->line . ',' . $this->old_declaration->display_name();
23
	// }
24
25
	function to_csv_array() {
26
		return array(
27
			'dependency',
28
			$this->invocation->path,
29
			$this->invocation->line,
30
			$this->invocation->display_name(),
31
			$this->declaration->display_name(),
32
		);
33
	}
34
35
	function full_path() {
36
		return $this->invocation_root ? $this->invocation_root . $this->invocation->path : $this->invocation->path;
37
	}
38
}