| 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 | * @inheritdoc |
||
| 35 | */ |
||
| 36 | 7 | public function handle(FormData $data) { |
|
| 42 | |||
| 43 | |||
| 44 | /** |
||
| 45 | * Value in checkbox can be true or false |
||
| 46 | * |
||
| 47 | * @param int $value |
||
| 48 | * @return $this |
||
| 49 | */ |
||
| 50 | 8 | public function setValue($value) { |
|
| 62 | |||
| 63 | |||
| 64 | /** |
||
| 65 | * @return $this |
||
| 66 | */ |
||
| 67 | 5 | public function check() { |
|
| 72 | |||
| 73 | |||
| 74 | /** |
||
| 75 | * Set value to 0 |
||
| 76 | * @return $this |
||
| 77 | */ |
||
| 78 | 7 | public function unCheck() { |
|
| 83 | |||
| 84 | |||
| 85 | /** |
||
| 86 | * @return bool |
||
| 87 | */ |
||
| 88 | 4 | public function isChecked() { |
|
| 91 | |||
| 92 | |||
| 93 | /** |
||
| 94 | * @param string $text |
||
| 95 | * @return $this |
||
| 96 | */ |
||
| 97 | 6 | public function setLabel($text) { |
|
| 101 | |||
| 102 | |||
| 103 | /** |
||
| 104 | * @return string |
||
| 105 | */ |
||
| 106 | 1 | public function render() { |
|
| 109 | |||
| 110 | } |
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.