1 | <?php |
---|
2 | /** |
---|
3 | * @brief maintenance, a plugin for Dotclear 2 |
---|
4 | * |
---|
5 | * @package Dotclear |
---|
6 | * @subpackage Plugins |
---|
7 | * |
---|
8 | * @copyright Olivier Meunier & Association Dotclear |
---|
9 | * @copyright GPL-2.0-only |
---|
10 | */ |
---|
11 | |
---|
12 | if (!defined('DC_RC_PATH')) {return;} |
---|
13 | |
---|
14 | /** |
---|
15 | @brief Simple descriptor for tabs, groups and more |
---|
16 | |
---|
17 | At this time this class is used in same way an arrayObject |
---|
18 | but in futur it could be completed with advance methods. |
---|
19 | */ |
---|
20 | class dcMaintenanceDescriptor |
---|
21 | { |
---|
22 | protected $id; |
---|
23 | protected $name; |
---|
24 | protected $options; |
---|
25 | |
---|
26 | /** |
---|
27 | * Constructor (really ?!). |
---|
28 | * |
---|
29 | * @param id <b>string<b> Tab ID |
---|
30 | * @param name <b>string<b> Tab name |
---|
31 | * @param options <b>string<b> Options |
---|
32 | */ |
---|
33 | public function __construct($id, $name, $options = []) |
---|
34 | { |
---|
35 | $this->id = (string) $id; |
---|
36 | $this->name = (string) $name; |
---|
37 | $this->options = (array) $options; |
---|
38 | } |
---|
39 | |
---|
40 | /** |
---|
41 | * Get ID. |
---|
42 | * |
---|
43 | * @return <b>string</b> ID |
---|
44 | */ |
---|
45 | public function id() |
---|
46 | { |
---|
47 | return $this->id; |
---|
48 | } |
---|
49 | |
---|
50 | /** |
---|
51 | * Get name. |
---|
52 | * |
---|
53 | * @return <b>string</b> Name |
---|
54 | */ |
---|
55 | public function name() |
---|
56 | { |
---|
57 | return $this->name; |
---|
58 | } |
---|
59 | |
---|
60 | /** |
---|
61 | * Get option. |
---|
62 | * |
---|
63 | * Option called "summary" and "description" are used. |
---|
64 | * |
---|
65 | * @param key <b>string<b> Option key |
---|
66 | * @return <b>string</b> Option value |
---|
67 | */ |
---|
68 | public function option($key) |
---|
69 | { |
---|
70 | return isset($this->options[$key]) ? $this->options[$key] : null; |
---|
71 | } |
---|
72 | |
---|
73 | /* @ignore */ |
---|
74 | public function __get($key) |
---|
75 | { |
---|
76 | return $this->option($key); |
---|
77 | } |
---|
78 | |
---|
79 | /* @ignore */ |
---|
80 | public function __isset($key) |
---|
81 | { |
---|
82 | return isset($this->options[$key]); |
---|
83 | } |
---|
84 | } |
---|