| 1 | <?php |
||
| 5 | trait Inline |
||
| 6 | { |
||
| 7 | protected $inline = false; |
||
| 8 | protected $inlineOptions = []; |
||
| 9 | protected $inlineUrl = ''; |
||
| 10 | |||
| 11 | 12 | public function inline(bool $enabled = true, array $options = []) |
|
| 18 | |||
| 19 | 12 | public function isInline(): bool |
|
| 23 | |||
| 24 | 4 | public function getInlineOptions(): array |
|
| 28 | |||
| 29 | 4 | public function setInlineUrl(string $url) |
|
| 33 | |||
| 34 | /** |
||
| 35 | * @return string |
||
| 36 | */ |
||
| 37 | 4 | public function getInlineUrl(): string |
|
| 41 | } |
||
| 42 |
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.