| 1 | <?php |
||
| 13 | class Checkbox extends Element\Input { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var int |
||
| 17 | */ |
||
| 18 | protected $value = 1; |
||
| 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 | * Value in checkbox can be true or false |
||
| 34 | * |
||
| 35 | * @param int|boolean $value |
||
| 36 | * @return $this |
||
| 37 | */ |
||
| 38 | public function setValue($value) { |
||
| 46 | |||
| 47 | |||
| 48 | /** |
||
| 49 | * @return $this |
||
| 50 | */ |
||
| 51 | public function check() { |
||
| 56 | |||
| 57 | |||
| 58 | /** |
||
| 59 | * Set value to 0 |
||
| 60 | * @return $this |
||
| 61 | */ |
||
| 62 | public function unCheck() { |
||
| 67 | |||
| 68 | |||
| 69 | /** |
||
| 70 | * @param string $text |
||
| 71 | * @return $this |
||
| 72 | */ |
||
| 73 | public function setLabel($text) { |
||
| 77 | |||
| 78 | |||
| 79 | /** |
||
| 80 | * @return string |
||
| 81 | */ |
||
| 82 | public function render() { |
||
| 85 | |||
| 86 | } |
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.