Passed
Push — master ( fe6195...c1edf4 )
by Julito
09:22
created

ResourceTemplate::setEdit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CoreBundle\Component\Utils;
6
7
class ResourceTemplate
8
{
9
    protected $index;
10
    protected $list;
11
    protected $edit;
12
    protected $viewResource;
13
    protected $new;
14
    protected $newFolder;
15
    protected $diskSpace;
16
    protected $info;
17
    protected $preview;
18
    protected $upload;
19
20
    public function __construct()
21
    {
22
        $this->index = '@ChamiloTheme/Resource/index.html.twig';
23
        $this->list = '@ChamiloTheme/Resource/index.html.twig';
24
        $this->edit = '@ChamiloTheme/Resource/edit.html.twig';
25
        // New resource
26
        $this->new = '@ChamiloTheme/Resource/new.html.twig';
27
        // New resource node (new folder)
28
        $this->newFolder = '@ChamiloTheme/Resource/new_folder.html.twig';
29
        $this->viewResource = '@ChamiloTheme/Resource/view_resource.html.twig';
30
        $this->diskSpace = '@ChamiloTheme/Resource/disk_space.html.twig';
31
        $this->info = '@ChamiloTheme/Resource/info.html.twig';
32
        $this->preview = '@ChamiloTheme/Resource/preview.html.twig';
33
        $this->upload = '@ChamiloTheme/Resource/upload.html.twig';
34
    }
35
36
    public function getFromAction(string $action)
37
    {
38
        $action = str_replace('Action', '', $action);
39
40
        if (property_exists($this, $action)) {
41
            return $this->$action;
42
        }
43
44
        throw new \InvalidArgumentException("No template found for action: $action");
45
    }
46
47
    public function setIndex(string $index): self
48
    {
49
        $this->index = $index;
50
51
        return $this;
52
    }
53
54
    public function setList(string $list): self
55
    {
56
        $this->list = $list;
57
58
        return $this;
59
    }
60
61
    public function setEdit(string $edit): self
62
    {
63
        $this->edit = $edit;
64
65
        return $this;
66
    }
67
68
    public function setViewResource(string $viewResource): self
69
    {
70
        $this->viewResource = $viewResource;
71
72
        return $this;
73
    }
74
75
    public function setNew(string $new): self
76
    {
77
        $this->new = $new;
78
79
        return $this;
80
    }
81
82
    public function setNewFolder(string $newFolder): self
83
    {
84
        $this->newFolder = $newFolder;
85
86
        return $this;
87
    }
88
89
    public function setDiskSpace(string $diskSpace): self
90
    {
91
        $this->diskSpace = $diskSpace;
92
93
        return $this;
94
    }
95
96
    public function setInfo(string $info): self
97
    {
98
        $this->info = $info;
99
100
        return $this;
101
    }
102
103
    public function setPreview(string $preview): self
104
    {
105
        $this->preview = $preview;
106
107
        return $this;
108
    }
109
110
    public function setUpload(string $upload): self
111
    {
112
        $this->upload = $upload;
113
114
        return $this;
115
    }
116
}
117