1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Erykai\Template; |
4
|
|
|
use Erykai\Translate\Translate; |
5
|
|
|
abstract class Resource |
6
|
|
|
{ |
7
|
|
|
use TraitTemplate; |
8
|
|
|
|
9
|
|
|
protected string $index; |
10
|
|
|
protected string $main; |
11
|
|
|
protected Translate $translate; |
12
|
|
|
protected string $page; |
13
|
|
|
protected ?string $menu; |
14
|
|
|
protected string $ext; |
15
|
|
|
protected string $themeIndex; |
16
|
|
|
protected string $themePage; |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
public function __construct(string $themeIndex, string $themePage, string $ext = "html", $menu = null) |
20
|
|
|
{ |
21
|
|
|
$this->translate = new Translate(); |
22
|
|
|
$this->setThemeIndex($themeIndex); |
23
|
|
|
$this->setThemePage($themePage); |
24
|
|
|
$this->setMenu($menu); |
25
|
|
|
$this->setExt($ext); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @return string |
30
|
|
|
*/ |
31
|
|
|
public function getIndex(): string |
32
|
|
|
{ |
33
|
|
|
return $this->index; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param string $index |
38
|
|
|
*/ |
39
|
|
|
protected function setIndex(string $index): void |
40
|
|
|
{ |
41
|
|
|
$this->index = $index; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return string |
46
|
|
|
*/ |
47
|
|
|
protected function getMain(): string |
48
|
|
|
{ |
49
|
|
|
return $this->main; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param string $main |
54
|
|
|
*/ |
55
|
|
|
protected function setMain(string $main): void |
56
|
|
|
{ |
57
|
|
|
$this->main = $main; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return string |
62
|
|
|
*/ |
63
|
|
|
protected function getPage(): string |
64
|
|
|
{ |
65
|
|
|
return $this->page; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param string $page |
70
|
|
|
*/ |
71
|
|
|
protected function setPage(string $page): void |
72
|
|
|
{ |
73
|
|
|
$this->page = $page; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
|
|
protected function getMenu(): ?string |
80
|
|
|
{ |
81
|
|
|
return $this->menu; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param ?string $menu |
86
|
|
|
*/ |
87
|
|
|
protected function setMenu(?string $menu): void |
88
|
|
|
{ |
89
|
|
|
$this->menu = $menu; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return string |
94
|
|
|
*/ |
95
|
|
|
protected function getExt(): string |
96
|
|
|
{ |
97
|
|
|
return $this->ext; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @param string $ext |
102
|
|
|
*/ |
103
|
|
|
protected function setExt(string $ext): void |
104
|
|
|
{ |
105
|
|
|
$this->ext = $ext; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @return string |
110
|
|
|
*/ |
111
|
|
|
protected function getThemeIndex(): string |
112
|
|
|
{ |
113
|
|
|
return $this->themeIndex; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @param string $theme |
118
|
|
|
*/ |
119
|
|
|
protected function setThemeIndex(string $theme): void |
120
|
|
|
{ |
121
|
|
|
$this->themeIndex = $theme; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
protected function getThemePage(): string |
125
|
|
|
{ |
126
|
|
|
return $this->themePage; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @param string $theme |
131
|
|
|
*/ |
132
|
|
|
protected function setThemePage(string $theme): void |
133
|
|
|
{ |
134
|
|
|
$this->themePage = $theme; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
|
138
|
|
|
} |