Code Duplication    Length = 34-34 lines in 2 locations

packages/analyzer/src/Invocations/Function_Call.php 1 location

@@ 13-46 (lines=34) @@
10
 *
11
 * TODO: detect dynamic invocations like `$function_name( 'hi' )`
12
 */
13
class Function_Call extends PersistentListItem implements Depends_On {
14
	public $path;
15
	public $line;
16
	public $func_name;
17
18
	public function __construct( $path, $line, $func_name ) {
19
		$this->path = $path;
20
		$this->line = $line;
21
		$this->func_name = $func_name;
22
	}
23
24
	public function to_csv_array() {
25
		return array(
26
			$this->type(),
27
			$this->path,
28
			$this->line,
29
			'',
30
			$this->func_name
31
		);
32
	}
33
34
	function type() {
35
		return 'function_call';
36
	}
37
38
	function display_name() {
39
		return $this->func_name;
40
	}
41
42
	function depends_on( $declaration ) {
43
		return $declaration instanceof Function_
44
			&& $this->func_name === $declaration->func_name;
45
	}
46
}

packages/analyzer/src/Invocations/New_.php 1 location

@@ 13-46 (lines=34) @@
10
 *
11
 * TODO: detect dynamic instantiations like `$shape = new $class_name( $this->images )`
12
 */
13
class New_ extends PersistentListItem implements Depends_On {
14
	public $path;
15
	public $line;
16
	public $class_name;
17
18
	public function __construct( $path, $line, $class_name ) {
19
		$this->path = $path;
20
		$this->line = $line;
21
		$this->class_name = $class_name;
22
	}
23
24
	public function to_csv_array() {
25
		return array(
26
			$this->type(),
27
			$this->path,
28
			$this->line,
29
			$this->class_name,
30
			''
31
		);
32
	}
33
34
	function type() {
35
		return 'new';
36
	}
37
38
	function display_name() {
39
		return 'new ' . $this->class_name;
40
	}
41
42
	function depends_on( $declaration ) {
43
		return $declaration instanceof Class_
44
			&& $this->class_name === $declaration->class_name;
45
	}
46
}