| 1 | <?php |
||
| 14 | class Checkbox extends Element\Input { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var int |
||
| 18 | */ |
||
| 19 | protected $value = 0; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | protected $label = ''; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var array |
||
| 28 | */ |
||
| 29 | protected $attributes = [ |
||
| 30 | 'type' => 'checkbox', |
||
| 31 | ]; |
||
| 32 | |||
| 33 | |||
| 34 | /** |
||
| 35 | * @inheritdoc |
||
| 36 | */ |
||
| 37 | 3 | public function handle(FormData $data) { |
|
| 40 | |||
| 41 | |||
| 42 | /** |
||
| 43 | * Value in checkbox can be true or false |
||
| 44 | * |
||
| 45 | * @param int $value |
||
| 46 | * @return $this |
||
| 47 | */ |
||
| 48 | 4 | public function setValue($value) { |
|
| 60 | |||
| 61 | |||
| 62 | /** |
||
| 63 | * @return $this |
||
| 64 | */ |
||
| 65 | 3 | public function check() { |
|
| 70 | |||
| 71 | |||
| 72 | /** |
||
| 73 | * Set value to 0 |
||
| 74 | * @return $this |
||
| 75 | */ |
||
| 76 | 3 | public function unCheck() { |
|
| 81 | |||
| 82 | |||
| 83 | /** |
||
| 84 | * @return bool |
||
| 85 | */ |
||
| 86 | 4 | public function isChecked() { |
|
| 89 | |||
| 90 | |||
| 91 | /** |
||
| 92 | * @param string $text |
||
| 93 | * @return $this |
||
| 94 | */ |
||
| 95 | 2 | public function setLabel($text) { |
|
| 99 | |||
| 100 | |||
| 101 | /** |
||
| 102 | * @return string |
||
| 103 | */ |
||
| 104 | 1 | public function render() { |
|
| 107 | |||
| 108 | } |
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.