Completed
Push — branch-7.5 ( 58010c...69c294 )
by
unknown
33:22 queued 21:52
created

Dependency   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

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
	function to_csv_array() {
19
		return array(
20
			'dependency',
21
			$this->invocation->path,
22
			$this->invocation->line,
23
			$this->invocation->display_name(),
24
			$this->declaration->display_name(),
25
		);
26
	}
27
28
	function full_path() {
29
		return $this->invocation_root ? $this->invocation_root . $this->invocation->path : $this->invocation->path;
30
	}
31
}