1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the syntaxhighligter-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2017 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\SyntaxHighlighterBundle\API; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* SyntaxHighlighter defaults. |
16
|
|
|
* |
17
|
|
|
* @author webeweb <https://github.com/webeweb/> |
18
|
|
|
* @package WBW\Bundle\SyntaxHighlighterBundle\API |
19
|
|
|
*/ |
20
|
|
|
class SyntaxHighlighterDefaults { |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Auto links. |
24
|
|
|
* |
25
|
|
|
* @var boolean |
26
|
|
|
*/ |
27
|
|
|
private $autoLinks = true; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Class name. |
31
|
|
|
* |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
private $className = ""; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Collapse. |
38
|
|
|
* |
39
|
|
|
* @var boolean |
40
|
|
|
*/ |
41
|
|
|
private $collapse = false; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* First line. |
45
|
|
|
* |
46
|
|
|
* @var integer |
47
|
|
|
*/ |
48
|
|
|
private $firstLine = 1; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Gutter. |
52
|
|
|
* |
53
|
|
|
* @var boolean |
54
|
|
|
*/ |
55
|
|
|
private $gutter = true; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Highlight. |
59
|
|
|
* |
60
|
|
|
* @var array |
61
|
|
|
*/ |
62
|
|
|
private $highlight; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* HTML script. |
66
|
|
|
* |
67
|
|
|
* @var boolean |
68
|
|
|
*/ |
69
|
|
|
private $htmlScript = false; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Samrt tabs. |
73
|
|
|
* |
74
|
|
|
* @var boolean |
75
|
|
|
*/ |
76
|
|
|
private $smartTabs = true; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Tab size. |
80
|
|
|
* |
81
|
|
|
* @var integer |
82
|
|
|
*/ |
83
|
|
|
private $tabSize = 4; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Toolbar. |
87
|
|
|
* |
88
|
|
|
* @var boolean |
89
|
|
|
*/ |
90
|
|
|
private $toolbar = true; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Constructor. |
94
|
|
|
*/ |
95
|
|
|
public function __construct() { |
96
|
|
|
// NOTHING TO DO. |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Get the auto links. |
101
|
|
|
* |
102
|
|
|
* @return boolean Returns the auto links. |
103
|
|
|
*/ |
104
|
|
|
public function getAutoLinks() { |
105
|
|
|
return $this->autoLinks; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Get the class name. |
110
|
|
|
* |
111
|
|
|
* @return string Returns the class name. |
112
|
|
|
*/ |
113
|
|
|
public function getClassName() { |
114
|
|
|
return $this->className; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Get the collapse. |
119
|
|
|
* |
120
|
|
|
* @return boolean Returns the collapse. |
121
|
|
|
*/ |
122
|
|
|
public function getCollapse() { |
123
|
|
|
return $this->collapse; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Get the first line. |
128
|
|
|
* |
129
|
|
|
* @return integer Returns the first line. |
130
|
|
|
*/ |
131
|
|
|
public function getFirstLine() { |
132
|
|
|
return $this->firstLine; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Get the gutter. |
137
|
|
|
* |
138
|
|
|
* @return boolean Returns the gutter. |
139
|
|
|
*/ |
140
|
|
|
public function getGutter() { |
141
|
|
|
return $this->gutter; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* Get the highlight. |
146
|
|
|
* |
147
|
|
|
* @return array Returns the hightlight. |
148
|
|
|
*/ |
149
|
|
|
public function getHighlight() { |
150
|
|
|
return $this->highlight; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Get the HTML script. |
155
|
|
|
* |
156
|
|
|
* @return boolean Returns the HTML script. |
157
|
|
|
*/ |
158
|
|
|
public function getHtmlScript() { |
159
|
|
|
return $this->htmlScript; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* Get the smart tabs. |
164
|
|
|
* |
165
|
|
|
* @return boolean Returns the smart tabs. |
166
|
|
|
*/ |
167
|
|
|
public function getSmartTabs() { |
168
|
|
|
return $this->smartTabs; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* Get the tab size. |
173
|
|
|
* |
174
|
|
|
* @return integer Returns the tab size. |
175
|
|
|
*/ |
176
|
|
|
public function getTabSize() { |
177
|
|
|
return $this->tabSize; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* Get the toolbar. |
182
|
|
|
* |
183
|
|
|
* @return boolean Returns the toolbar. |
184
|
|
|
*/ |
185
|
|
|
public function getToolbar() { |
186
|
|
|
return $this->toolbar; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* Set the auto links. |
191
|
|
|
* |
192
|
|
|
* @param boolean $autoLinks The auto links. |
193
|
|
|
* @return SyntaxHighlighterDefaults Returns this SyntaxHighlighter defaults. |
194
|
|
|
*/ |
195
|
|
|
public function setAutoLinks($autoLinks = true) { |
196
|
|
|
$this->autoLinks = $autoLinks; |
197
|
|
|
return $this; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* Set the class name. |
202
|
|
|
* |
203
|
|
|
* @param string $className The class name. |
204
|
|
|
* @return SyntaxHighlighterDefaults Returns this SyntaxHighlighter defaults. |
205
|
|
|
*/ |
206
|
|
|
public function setClassName($className = "") { |
207
|
|
|
$this->className = $className; |
208
|
|
|
return $this; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* Set the collapse. |
213
|
|
|
* |
214
|
|
|
* @param boolean $collapse The collapse. |
215
|
|
|
* @return SyntaxHighlighterDefaults Returns this SyntaxHighlighter defaults. |
216
|
|
|
*/ |
217
|
|
|
public function setCollapse($collapse = false) { |
218
|
|
|
$this->collapse = $collapse; |
219
|
|
|
return $this; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* Set the first line. |
224
|
|
|
* |
225
|
|
|
* @param integer $firstLine The first line. |
226
|
|
|
* @return SyntaxHighlighterDefaults Returns this SyntaxHighlighter defaults. |
227
|
|
|
*/ |
228
|
|
|
public function setFirstLine($firstLine = 1) { |
229
|
|
|
$this->firstLine = $firstLine; |
230
|
|
|
return $this; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* Set the gutter. |
235
|
|
|
* |
236
|
|
|
* @param boolean $gutter The gutter. |
237
|
|
|
* @return SyntaxHighlighterDefaults Returns this SyntaxHighlighter defaults. |
238
|
|
|
*/ |
239
|
|
|
public function setGutter($gutter = true) { |
240
|
|
|
$this->gutter = $gutter; |
241
|
|
|
return $this; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* Set the highlight. |
246
|
|
|
* |
247
|
|
|
* @param array $highlight The highlight. |
248
|
|
|
* @return SyntaxHighlighterDefaults Returns this SyntaxHighlighter defaults. |
249
|
|
|
|
250
|
|
|
*/ |
251
|
|
|
public function setHighlight(array $highlight = null) { |
252
|
|
|
$this->highlight = $highlight; |
253
|
|
|
return $this; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* Set the HTML script. |
258
|
|
|
* |
259
|
|
|
* @param boolean $htmlScript The HTML script. |
260
|
|
|
* @return SyntaxHighlighterDefaults Returns this SyntaxHighlighter defaults. |
261
|
|
|
|
262
|
|
|
*/ |
263
|
|
|
public function setHtmlScript($htmlScript = false) { |
264
|
|
|
$this->htmlScript = $htmlScript; |
265
|
|
|
return $this; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* Set the smart tabs. |
270
|
|
|
* |
271
|
|
|
* @param boolean $smartTabs The smart tabs. |
272
|
|
|
* @return SyntaxHighlighterDefaults Returns this SyntaxHighlighter defaults. |
273
|
|
|
*/ |
274
|
|
|
public function setSmartTabs($smartTabs = true) { |
275
|
|
|
$this->smartTabs = $smartTabs; |
276
|
|
|
return $this; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* Set the tab size. |
281
|
|
|
* |
282
|
|
|
* @param integer $tabSize The tab size. |
283
|
|
|
* @return SyntaxHighlighterDefaults Returns this SyntaxHighlighter defaults. |
284
|
|
|
|
285
|
|
|
*/ |
286
|
|
|
public function setTabSize($tabSize = 4) { |
287
|
|
|
$this->tabSize = $tabSize; |
288
|
|
|
return $this; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* Set the toolbar. |
293
|
|
|
* |
294
|
|
|
* @param boolean $toolbar The toolbar. |
295
|
|
|
* @return SyntaxHighlighterDefaults Returns this SyntaxHighlighter defaults. |
296
|
|
|
|
297
|
|
|
*/ |
298
|
|
|
public function setToolbar($toolbar = true) { |
299
|
|
|
$this->toolbar = $toolbar; |
300
|
|
|
return $this; |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
} |
304
|
|
|
|