Total Complexity | 5 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Coverage | 95.45% |
Changes | 0 |
1 | <?php |
||
8 | class FormElementSelect extends FormElement |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * Constructor |
||
13 | * |
||
14 | * @param string $name of the element. |
||
15 | * @param array $attributes to set to the element. Default is an empty array. |
||
16 | * |
||
17 | * @throws Exception if missing <options> |
||
18 | */ |
||
19 | 8 | public function __construct($name, $attributes = []) |
|
20 | { |
||
21 | 8 | parent::__construct($name, $attributes); |
|
22 | 8 | $this['type'] = 'select'; |
|
23 | 8 | $this->UseNameAsDefaultLabel(); |
|
24 | |||
25 | 8 | if (!is_array($this['options'])) { |
|
26 | 2 | throw new Exception("Select needs options, did you forget to specify them when creating the element?"); |
|
27 | } |
||
28 | 6 | } |
|
29 | |||
30 | |||
31 | |||
32 | /** |
||
33 | * Get HTML code for a element. |
||
34 | * |
||
35 | * @return string HTML code for the element. |
||
36 | * |
||
37 | * @SuppressWarnings(PHPMD.UnusedLocalVariable) |
||
38 | */ |
||
39 | 2 | public function getHTML() |
|
62 | EOD; |
||
63 | } |
||
65 |