| 1 | <?php |
||
| 7 | trait Localizable |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Boot trait |
||
| 11 | */ |
||
| 12 | public static function bootLocalizable() |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Get column name |
||
| 19 | * |
||
| 20 | * @return string |
||
| 21 | */ |
||
| 22 | public function getLocalizableColumn() |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Get column name with table name |
||
| 31 | * |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | public function getQualifiedLocalizableColumn() |
||
| 38 | } |
||
| 39 |
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.