1 | <?php |
||
10 | trait LayerEffectTrait |
||
11 | { |
||
12 | /** |
||
13 | * @var float $opacity |
||
14 | */ |
||
15 | private $opacity = 1.0; |
||
16 | |||
17 | /** |
||
18 | * @var string $gravity |
||
19 | */ |
||
20 | private $gravity = 'nw'; |
||
21 | |||
22 | /** |
||
23 | * Horizontal adjustment, in pixels. |
||
24 | * Negative values will move mask to the left, positive values to the right. |
||
25 | * Depends on the gravity setting |
||
26 | * @var integer $x |
||
27 | */ |
||
28 | private $x = 0; |
||
29 | |||
30 | /** |
||
31 | * Vertical adjustment, in pixels. |
||
32 | * Negative values will move mask to the top, positive values to the bottom. |
||
33 | * Depends on the gravity setting |
||
34 | * @var integer $y |
||
35 | */ |
||
36 | private $y = 0; |
||
37 | |||
38 | /** |
||
39 | * @param float $opacity The mask opacity. |
||
40 | * @throws InvalidArgumentException If the mask opacity is not a numeric value or not between 0.0 and 1.0. |
||
41 | * @return AbstractMaskEffect Chainable |
||
42 | */ |
||
43 | public function setOpacity($opacity) |
||
53 | |||
54 | /** |
||
55 | * @return float |
||
56 | */ |
||
57 | public function opacity() |
||
61 | |||
62 | /** |
||
63 | * @param string $gravity The mask gravity. |
||
64 | * @throws InvalidArgumentException If the argument is not a valid gravity name. |
||
65 | * @return AbstractMaskEffect Chainable |
||
66 | */ |
||
67 | public function setGravity($gravity) |
||
77 | |||
78 | /** |
||
79 | * @return string |
||
80 | */ |
||
81 | public function gravity() |
||
85 | |||
86 | /** |
||
87 | * @param integer $x The mask X position. |
||
88 | * @throws InvalidArgumentException If the position is not a numeric value. |
||
89 | * @return AbstractMaskEffect Chainable |
||
90 | */ |
||
91 | public function setX($x) |
||
101 | |||
102 | /** |
||
103 | * @return float |
||
104 | */ |
||
105 | public function x() |
||
109 | |||
110 | /** |
||
111 | * @param integer $y The Y position. |
||
112 | * @throws InvalidArgumentException If the position is not a numeric value. |
||
113 | * @return AbstractMaskEffect Chainable |
||
114 | */ |
||
115 | public function setY($y) |
||
125 | |||
126 | /** |
||
127 | * @return float |
||
128 | */ |
||
129 | public function y() |
||
133 | } |
||
134 |
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.