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

Warning::unique_issue_key()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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
}