| 1 | <?php |
||
| 8 | class Input extends BaseElement { |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @var string |
||
| 12 | */ |
||
| 13 | protected $tag = 'input'; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var array |
||
| 17 | */ |
||
| 18 | protected $attributes = [ |
||
| 19 | 'type' => 'text', |
||
| 20 | ]; |
||
| 21 | |||
| 22 | |||
| 23 | /** |
||
| 24 | * @return null|string |
||
| 25 | */ |
||
| 26 | 3 | public function getType() { |
|
| 27 | 3 | if (!empty($this->attributes['type'])) { |
|
| 28 | 3 | return $this->attributes['type']; |
|
| 29 | } |
||
| 30 | |||
| 31 | return null; |
||
| 32 | } |
||
| 33 | |||
| 34 | |||
| 35 | /** |
||
| 36 | * Alias of $this->setAttribute('type' 'text'); |
||
| 37 | * |
||
| 38 | * @param string $type |
||
| 39 | * @return $this |
||
| 40 | */ |
||
| 41 | 4 | public function setType($type) { |
|
| 42 | 4 | $this->attributes['type'] = $type; |
|
| 43 | 4 | return $this; |
|
| 44 | } |
||
| 45 | |||
| 46 | |||
| 47 | /** |
||
| 48 | * @param $value |
||
| 49 | * @return $this |
||
| 50 | */ |
||
| 51 | 13 | public function setValue($value) { |
|
| 52 | 13 | $this->setAttribute('value', $value); |
|
| 53 | 13 | return $this; |
|
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * |
||
| 58 | * @return string |
||
| 59 | */ |
||
| 60 | 3 | public function render() { |
|
| 64 | |||
| 65 | } |