1 | <?php |
||
7 | trait TransformTrait |
||
8 | { |
||
9 | /** |
||
10 | * @var TransformInterface |
||
11 | */ |
||
12 | protected $transformImpl; |
||
13 | |||
14 | /** |
||
15 | * @inheritdoc |
||
16 | */ |
||
17 | public function result() |
||
21 | |||
22 | /** |
||
23 | * @inheritdoc |
||
24 | */ |
||
25 | public function setArgumentDelimiter($delim) |
||
29 | |||
30 | /** |
||
31 | * @inheritdoc |
||
32 | */ |
||
33 | 4 | public function rotate($angle, $cx = null, $cy = null) |
|
34 | { |
||
35 | 4 | $this->setTransformAttribute($this->transformImpl->rotate($angle, $cx, $cy)); |
|
|
|||
36 | |||
37 | 4 | return $this; |
|
38 | } |
||
39 | |||
40 | /** |
||
41 | * @inheritdoc |
||
42 | */ |
||
43 | public function translate($x, $y = null) |
||
49 | |||
50 | /** |
||
51 | * @inheritdoc |
||
52 | */ |
||
53 | public function scale($x, $y = null) |
||
59 | |||
60 | /** |
||
61 | * @inheritdoc |
||
62 | */ |
||
63 | public function skewX($x) |
||
69 | |||
70 | /** |
||
71 | * @inheritdoc |
||
72 | */ |
||
73 | public function skewY($y) |
||
79 | |||
80 | /** |
||
81 | * @inheritdoc |
||
82 | */ |
||
83 | public function matrix(array $matrix) |
||
89 | } |
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.