| 1 | <?php |
||
| 10 | trait RichTextConvertingEntity |
||
| 11 | { |
||
| 12 | protected $richTextConverter; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @param Converter $richTextConverter |
||
| 16 | * @return $this |
||
| 17 | */ |
||
| 18 | 3 | public function setRichTextConverter(Converter $richTextConverter) |
|
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $xml the value of an xml-text field |
||
| 26 | * @return string |
||
| 27 | */ |
||
| 28 | protected function getHtml($xml) |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param $fieldName the identifier of an xml-text field |
||
| 35 | * @return string |
||
| 36 | */ |
||
| 37 | protected function getHtmlForField($fieldName) |
||
| 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.