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

Dependency   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 32
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A to_csv_array() 0 9 1
A full_path() 0 3 2
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
}