| 1 | <?php |
||
| 8 | trait FBCBreadcrumbTrait |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Create a breadcrumb, append slash / to all dirs. |
||
| 12 | * |
||
| 13 | * @param string $route current route. |
||
| 14 | * |
||
| 15 | * @return array with values for the breadcrumb. |
||
| 16 | */ |
||
| 17 | public function createBreadcrumb($route) |
||
| 32 | |||
| 33 | |||
| 34 | |||
| 35 | /** |
||
| 36 | * Get the title of a document to use for breadcrumb. |
||
| 37 | * |
||
| 38 | * @param string $file to get title from. |
||
| 39 | * |
||
| 40 | * @return string as the breadcrumb title. |
||
| 41 | */ |
||
| 42 | private function getBreadcrumbTitle($file) |
||
| 52 | } |
||
| 53 |
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.