Code Duplication    Length = 38-40 lines in 2 locations

mysite/src/Controllers/AddonController.php 1 location

@@ 11-50 (lines=40) @@
8
/**
9
 * Displays information about an add-on and its versions.
10
 */
11
class AddonController extends SiteController 
12
{
13
14
	private static $allowed_actions = [
15
		'index'
16
	];
17
18
	protected $parent;
19
20
	protected $addon;
21
22
	public function __construct(Controller $parent, Addon $addon) 
23
	{
24
		$this->parent = $parent;
25
		$this->addon = $addon;
26
27
		parent::__construct();
28
	}
29
30
	public function index() 
31
	{
32
		return $this->renderWith(['Addon', 'Page']);
33
	}
34
35
	public function Title() 
36
	{
37
		return $this->addon->Name;
38
	}
39
40
	public function Link() 
41
	{
42
		return $this->addon->Link();
43
	}
44
45
	public function Addon() 
46
	{
47
		return $this->addon;
48
	}
49
50
}
51

mysite/src/Controllers/AuthorController.php 1 location

@@ 11-48 (lines=38) @@
8
/**
9
 * Displays an individual author and lists their add-ons.
10
 */
11
class AuthorController extends SiteController {
12
13
	private static $allowed_actions = [
14
		'index'
15
	];
16
17
	protected $parent;
18
19
	protected $author;
20
21
	public function __construct(Controller $parent, AddonAuthor $author) 
22
	{
23
		$this->parent = $parent;
24
		$this->author = $author;
25
26
		parent::__construct();
27
	}
28
29
	public function index() 
30
	{
31
		return $this->renderWith(array('Author', 'Page'));
32
	}
33
34
	public function Title() 
35
	{
36
		return $this->author->Name;
37
	}
38
39
	public function Link() 
40
	{
41
		return Controller::join_links($this->parent->Link(), $this->author->ID);
42
	}
43
44
	public function Author() {
45
		return $this->author;
46
	}
47
48
}