|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Superdesk Web Publisher Content Bundle. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright 2016 Sourcefabric z.ú. and contributors. |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please see the |
|
9
|
|
|
* AUTHORS and LICENSE files distributed with this source code. |
|
10
|
|
|
* |
|
11
|
|
|
* @copyright 2016 Sourcefabric z.ú |
|
12
|
|
|
* @license http://www.superdesk.org/license |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace SWP\Bundle\ContentBundle\Model; |
|
16
|
|
|
|
|
17
|
|
|
trait RouteTrait |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* @var string |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $templateName; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
protected $articlesTemplateName; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var string |
|
31
|
|
|
*/ |
|
32
|
|
|
protected $type; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var int |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $cacheTimeInSeconds = 0; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var string |
|
41
|
|
|
*/ |
|
42
|
|
|
protected $name; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var string |
|
46
|
|
|
*/ |
|
47
|
|
|
protected $slug; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @var string |
|
51
|
|
|
*/ |
|
52
|
|
|
protected $variablePattern; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @var string |
|
56
|
|
|
*/ |
|
57
|
|
|
protected $staticPrefix; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @var int |
|
61
|
|
|
*/ |
|
62
|
30 |
|
protected $position; |
|
63
|
|
|
|
|
64
|
30 |
|
/** |
|
65
|
|
|
* @return string |
|
66
|
|
|
*/ |
|
67
|
|
|
public function getName() |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->name; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Rename a route by setting its new name. |
|
74
|
104 |
|
* |
|
75
|
|
|
* @param string $name the new name |
|
76
|
104 |
|
*/ |
|
77
|
104 |
|
public function setName($name) |
|
78
|
|
|
{ |
|
79
|
|
|
$this->name = $name; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
24 |
|
/** |
|
83
|
|
|
* @return string |
|
84
|
24 |
|
*/ |
|
85
|
|
|
public function getSlug(): ?string |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->slug; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
30 |
|
/** |
|
91
|
|
|
* Slug is used for static prefix generation. |
|
92
|
30 |
|
* |
|
93
|
30 |
|
* @param string $slug |
|
94
|
|
|
*/ |
|
95
|
|
|
public function setSlug(string $slug): void |
|
96
|
|
|
{ |
|
97
|
|
|
$this->slug = $slug; |
|
98
|
28 |
|
} |
|
99
|
|
|
|
|
100
|
28 |
|
/** |
|
101
|
|
|
* @return string |
|
102
|
|
|
*/ |
|
103
|
|
|
public function getVariablePattern() |
|
104
|
|
|
{ |
|
105
|
|
|
return $this->variablePattern; |
|
106
|
11 |
|
} |
|
107
|
|
|
|
|
108
|
11 |
|
/** |
|
109
|
11 |
|
* @param string $variablePattern |
|
110
|
|
|
*/ |
|
111
|
|
|
public function setVariablePattern($variablePattern) |
|
112
|
|
|
{ |
|
113
|
|
|
$this->variablePattern = $variablePattern; |
|
114
|
18 |
|
} |
|
115
|
|
|
|
|
116
|
18 |
|
/** |
|
117
|
|
|
* {@inheritdoc} |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getTemplateName() |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->templateName; |
|
122
|
10 |
|
} |
|
123
|
|
|
|
|
124
|
10 |
|
/** |
|
125
|
10 |
|
* {@inheritdoc} |
|
126
|
|
|
*/ |
|
127
|
|
|
public function setTemplateName($templateName) |
|
128
|
|
|
{ |
|
129
|
|
|
$this->templateName = $templateName; |
|
130
|
30 |
|
} |
|
131
|
|
|
|
|
132
|
30 |
|
/** |
|
133
|
|
|
* {@inheritdoc} |
|
134
|
|
|
*/ |
|
135
|
|
|
public function getArticlesTemplateName() |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->articlesTemplateName; |
|
138
|
104 |
|
} |
|
139
|
|
|
|
|
140
|
104 |
|
/** |
|
141
|
104 |
|
* {@inheritdoc} |
|
142
|
|
|
*/ |
|
143
|
|
|
public function setArticlesTemplateName($articlesTemplateName) |
|
144
|
|
|
{ |
|
145
|
|
|
$this->articlesTemplateName = $articlesTemplateName; |
|
146
|
22 |
|
} |
|
147
|
|
|
|
|
148
|
22 |
|
/** |
|
149
|
|
|
* {@inheritdoc} |
|
150
|
|
|
*/ |
|
151
|
|
|
public function getType() |
|
152
|
|
|
{ |
|
153
|
|
|
return $this->type; |
|
154
|
2 |
|
} |
|
155
|
|
|
|
|
156
|
2 |
|
/** |
|
157
|
2 |
|
* {@inheritdoc} |
|
158
|
|
|
*/ |
|
159
|
|
|
public function setType($type) |
|
160
|
|
|
{ |
|
161
|
|
|
$this->type = $type; |
|
162
|
24 |
|
} |
|
163
|
|
|
|
|
164
|
24 |
|
/** |
|
165
|
|
|
* @return int |
|
166
|
|
|
*/ |
|
167
|
|
|
public function getCacheTimeInSeconds() |
|
168
|
|
|
{ |
|
169
|
|
|
return $this->cacheTimeInSeconds; |
|
170
|
30 |
|
} |
|
171
|
|
|
|
|
172
|
30 |
|
/** |
|
173
|
30 |
|
* @param int $cacheTimeInSeconds |
|
174
|
|
|
*/ |
|
175
|
|
|
public function setCacheTimeInSeconds($cacheTimeInSeconds) |
|
176
|
|
|
{ |
|
177
|
|
|
$this->cacheTimeInSeconds = $cacheTimeInSeconds; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
/** |
|
181
|
|
|
* @return string |
|
182
|
|
|
*/ |
|
183
|
|
|
public function getStaticPrefix() |
|
184
|
|
|
{ |
|
185
|
|
|
return $this->staticPrefix; |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* @param string $staticPrefix |
|
190
|
|
|
*/ |
|
191
|
|
|
public function setStaticPrefix($staticPrefix) |
|
192
|
|
|
{ |
|
193
|
|
|
$this->staticPrefix = $staticPrefix; |
|
194
|
|
|
} |
|
195
|
|
|
|
|
196
|
|
|
/** |
|
197
|
|
|
* @return int |
|
198
|
|
|
*/ |
|
199
|
|
|
public function getPosition() |
|
200
|
|
|
{ |
|
201
|
|
|
return $this->position; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
/** |
|
205
|
|
|
* @param int $position |
|
206
|
|
|
*/ |
|
207
|
|
|
public function setPosition(int $position) |
|
208
|
|
|
{ |
|
209
|
|
|
$this->position = $position; |
|
210
|
|
|
} |
|
211
|
|
|
} |
|
212
|
|
|
|