| 1 | <?php |
||
| 13 | class Checkbox extends Element\Input { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var int |
||
| 17 | */ |
||
| 18 | protected $value = 0; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | protected $label = ''; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var array |
||
| 27 | */ |
||
| 28 | protected $attributes = [ |
||
| 29 | 'type' => 'checkbox', |
||
| 30 | ]; |
||
| 31 | |||
| 32 | |||
| 33 | /** |
||
| 34 | * Value in checkbox can be true or false |
||
| 35 | * |
||
| 36 | * @param int $value |
||
| 37 | * @return $this |
||
| 38 | */ |
||
| 39 | public function setValue($value) { |
||
| 51 | |||
| 52 | |||
| 53 | /** |
||
| 54 | * @return $this |
||
| 55 | */ |
||
| 56 | public function check() { |
||
| 61 | |||
| 62 | |||
| 63 | /** |
||
| 64 | * Set value to 0 |
||
| 65 | * @return $this |
||
| 66 | */ |
||
| 67 | public function unCheck() { |
||
| 72 | |||
| 73 | |||
| 74 | /** |
||
| 75 | * @return bool |
||
| 76 | */ |
||
| 77 | public function isChecked() { |
||
| 80 | |||
| 81 | |||
| 82 | /** |
||
| 83 | * @param string $text |
||
| 84 | * @return $this |
||
| 85 | */ |
||
| 86 | public function setLabel($text) { |
||
| 90 | |||
| 91 | |||
| 92 | /** |
||
| 93 | * @return string |
||
| 94 | */ |
||
| 95 | public function render() { |
||
| 98 | |||
| 99 | } |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.