1 | <?php |
||
7 | trait BaseTrait { |
||
8 | protected $_variations=[]; |
||
9 | protected $_states=[]; |
||
10 | protected $_baseClass; |
||
11 | |||
12 | public function addVariation($variation){ |
||
15 | |||
16 | public function addState($state){ |
||
19 | |||
20 | public function setVariation($variation){ |
||
24 | |||
25 | public function setState($state){ |
||
29 | |||
30 | /** |
||
31 | * {@inheritDoc} |
||
32 | * @see \Ajax\common\html\HtmlSingleElement::setSize() |
||
33 | */ |
||
34 | public function setSize($size){ |
||
37 | |||
38 | /** |
||
39 | * show it is currently unable to be interacted with |
||
40 | * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
||
41 | */ |
||
42 | public function setDisabled(){ |
||
45 | |||
46 | /** |
||
47 | * @param string $color |
||
48 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
||
49 | */ |
||
50 | public function setColor($color){ |
||
53 | |||
54 | public function setFluid(){ |
||
57 | |||
58 | /** |
||
59 | * can be formatted to appear on dark backgrounds |
||
60 | */ |
||
61 | public function setInverted(){ |
||
64 | } |
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.