Code Duplication    Length = 33-33 lines in 2 locations

mysite/code/controllers/AddonController.php 1 location

@@ 5-37 (lines=33) @@
2
/**
3
 * Displays information about an add-on and its versions.
4
 */
5
class AddonController extends SiteController
6
{
7
8
    public static $allowed_actions = array(
9
        'index'
10
    );
11
12
    protected $parent;
13
    protected $addon;
14
15
    public function __construct(Controller $parent, Addon $addon)
16
    {
17
        $this->parent = $parent;
18
        $this->addon = $addon;
19
20
        parent::__construct();
21
    }
22
23
    public function index()
24
    {
25
        return $this->renderWith(array('Addon', 'Page'));
26
    }
27
28
    public function Title()
29
    {
30
        return $this->addon->Name;
31
    }
32
33
    public function Link()
34
    {
35
        return $this->addon->Link();
36
    }
37
38
    public function Addon()
39
    {
40
        return $this->addon;

mysite/code/controllers/AuthorController.php 1 location

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