[2044] | 1 | <?php |
---|
[3731] | 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 | |
---|
[3730] | 12 | if (!defined('DC_RC_PATH')) {return;} |
---|
[2044] | 13 | |
---|
| 14 | /** |
---|
| 15 | @brief Simple descriptor for tabs, groups and more |
---|
| 16 | |
---|
[2566] | 17 | At this time this class is used in same way an arrayObject |
---|
[2044] | 18 | but in futur it could be completed with advance methods. |
---|
[3730] | 19 | */ |
---|
[2044] | 20 | class dcMaintenanceDescriptor |
---|
| 21 | { |
---|
[3730] | 22 | protected $id; |
---|
| 23 | protected $name; |
---|
| 24 | protected $options; |
---|
[2044] | 25 | |
---|
[3730] | 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 | */ |
---|
[3874] | 33 | public function __construct($id, $name, $options = []) |
---|
[3730] | 34 | { |
---|
| 35 | $this->id = (string) $id; |
---|
| 36 | $this->name = (string) $name; |
---|
| 37 | $this->options = (array) $options; |
---|
| 38 | } |
---|
[2044] | 39 | |
---|
[3730] | 40 | /** |
---|
| 41 | * Get ID. |
---|
| 42 | * |
---|
| 43 | * @return <b>string</b> ID |
---|
| 44 | */ |
---|
| 45 | public function id() |
---|
| 46 | { |
---|
| 47 | return $this->id; |
---|
| 48 | } |
---|
[2044] | 49 | |
---|
[3730] | 50 | /** |
---|
| 51 | * Get name. |
---|
| 52 | * |
---|
| 53 | * @return <b>string</b> Name |
---|
| 54 | */ |
---|
| 55 | public function name() |
---|
| 56 | { |
---|
| 57 | return $this->name; |
---|
| 58 | } |
---|
[2044] | 59 | |
---|
[3730] | 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 | } |
---|
[2044] | 72 | |
---|
[3730] | 73 | /* @ignore */ |
---|
| 74 | public function __get($key) |
---|
| 75 | { |
---|
| 76 | return $this->option($key); |
---|
| 77 | } |
---|
[2044] | 78 | |
---|
[3730] | 79 | /* @ignore */ |
---|
| 80 | public function __isset($key) |
---|
| 81 | { |
---|
| 82 | return isset($this->options[$key]); |
---|
| 83 | } |
---|
[2044] | 84 | } |
---|