Total Complexity | 5 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class Select { |
||
12 | |||
13 | protected $options; |
||
14 | private $current; |
||
15 | |||
16 | /** |
||
17 | * Retorna "selected" se os valores são iguais |
||
18 | * @param mixed $value1 |
||
19 | * @param mixed $value2 |
||
20 | * @return string |
||
21 | */ |
||
22 | public static function selected($value1, $value2 = true) { |
||
23 | return ($value1 == $value2) ? 'selected' : ''; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Cria um <select> com <options>, selecionando automático |
||
28 | * @param string[] $options |
||
29 | * @param string $current |
||
30 | */ |
||
31 | public function __construct($options, $current = '') { |
||
32 | $this->options = $options; |
||
33 | $this->current = $current; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Exibe os <options> do <select> |
||
38 | * @return string |
||
39 | */ |
||
40 | public function __toString() { |
||
46 | } |
||
47 | |||
48 | } |
||
49 |