1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @copyright Copyright (c) 2019 Julius Härtl <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @author Julius Härtl <[email protected]> |
6
|
|
|
* |
7
|
|
|
* @license GNU AGPL version 3 or any later version |
8
|
|
|
* |
9
|
|
|
* This program is free software: you can redistribute it and/or modify |
10
|
|
|
* it under the terms of the GNU Affero General Public License as |
11
|
|
|
* published by the Free Software Foundation, either version 3 of the |
12
|
|
|
* License, or (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* This program is distributed in the hope that it will be useful, |
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
|
|
|
* GNU Affero General Public License for more details. |
18
|
|
|
* |
19
|
|
|
* You should have received a copy of the GNU Affero General Public License |
20
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
21
|
|
|
* |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
namespace OCP\DirectEditing; |
25
|
|
|
|
26
|
|
|
use JsonSerializable; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Class ATemplate |
30
|
|
|
* |
31
|
|
|
* @package OCP\DirectEditing |
32
|
|
|
* @since 18.0.0 |
33
|
|
|
*/ |
34
|
|
|
abstract class ATemplate implements JsonSerializable { |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Return a unique id so the app can identify the template |
38
|
|
|
* |
39
|
|
|
* @since 18.0.0 |
40
|
|
|
* @return string |
41
|
|
|
*/ |
42
|
|
|
abstract public function getId(): string; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Return a title that is displayed to the user |
46
|
|
|
* |
47
|
|
|
* @since 18.0.0 |
48
|
|
|
* @return string |
49
|
|
|
*/ |
50
|
|
|
abstract public function getTitle(): string; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Return a link to the template preview image |
54
|
|
|
* |
55
|
|
|
* @since 18.0.0 |
56
|
|
|
* @return string |
57
|
|
|
*/ |
58
|
|
|
abstract public function getPreview(): string; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @since 18.0.0 |
62
|
|
|
* @return array|mixed |
63
|
|
|
*/ |
64
|
|
|
public function jsonSerialize() { |
65
|
|
|
return [ |
66
|
|
|
'id' => $this->getId(), |
67
|
|
|
'title' => $this->getTitle(), |
68
|
|
|
'preview' => $this->getPreview(), |
69
|
|
|
]; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|