| 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 | * @param int $angle |
||
| 33 | */ |
||
| 34 | 4 | public function rotate($angle, $cx = null, $cy = null) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * @inheritdoc |
||
| 43 | */ |
||
| 44 | public function translate($x, $y = null) |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @inheritdoc |
||
| 53 | */ |
||
| 54 | public function scale($x, $y = null) |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @inheritdoc |
||
| 63 | */ |
||
| 64 | public function skewX($x) |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @inheritdoc |
||
| 73 | */ |
||
| 74 | public function skewY($y) |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @inheritdoc |
||
| 83 | */ |
||
| 84 | public function matrix(array $matrix) |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @inheritdoc |
||
| 93 | */ |
||
| 94 | public function compact() |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @inheritdoc |
||
| 103 | */ |
||
| 104 | public function toMatrix() |
||
| 110 | } |
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
Idableprovides a methodequalsIdthat 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.