Completed
Push — add/legacy-files ( 4cc789...bef25d )
by
unknown
157:43 queued 148:20
created

Warning   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A unique_issue_key() 0 3 1
A to_csv_array() 0 9 1
1
<?php
2
3
namespace Automattic\Jetpack\Analyzer\Warnings;
4
use Automattic\Jetpack\Analyzer\PersistentList\Item as PersistentListItem;
5
6
class Warning extends PersistentListItem {
7
	public $type;
8
	public $path;
9
	public $line;
10
	public $message;
11
	public $old_declaration;
12
13
	function __construct( $type, $path, $line, $message, $old_declaration ) {
14
		$this->type = $type;
15
		$this->path = $path;
16
		$this->line = $line;
17
		$this->message = $message;
18
		$this->old_declaration = $old_declaration;
19
	}
20
21
	/**
22
	 * This key is used to identify unique issues (e.g. Jetpack_Options has moved) across multiple invocations
23
	 */
24
	function unique_issue_key() {
25
		return $this->type . ',' . $this->old_declaration->path . ',' . $this->old_declaration->line . ',' . $this->old_declaration->display_name();
26
	}
27
28
	function to_csv_array() {
29
		return array(
30
			$this->type,
31
			$this->path,
32
			$this->line,
33
			$this->message,
34
			$this->old_declaration->display_name(),
35
		);
36
	}
37
}