1 | <?php |
||
7 | trait CheckboxTrait { |
||
8 | |||
9 | public abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
||
10 | |||
11 | public function setType($checkboxType) { |
||
14 | |||
15 | /** |
||
16 | * Attach $this to $selector and fire $action |
||
17 | * @param string $selector jquery selector of the associated element |
||
18 | * @param string $action action to execute : check, uncheck or NULL for toggle |
||
19 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
||
20 | */ |
||
21 | public function attachEvent($selector, $action=NULL) { |
||
24 | |||
25 | /** |
||
26 | * Attach $this to an array of $action=>$selector |
||
27 | * @param array $events associative array of events to attach ex : ["#bt-toggle","check"=>"#bt-check","uncheck"=>"#bt-uncheck"] |
||
28 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
||
29 | */ |
||
30 | public function attachEvents($events=array()) { |
||
33 | } |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.