| 1 | <?php |
||
| 11 | trait CollectionsOperationsTrait |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @inheritdoc |
||
| 15 | * @deprecated Use all() |
||
| 16 | */ |
||
| 17 | public function getRoutes() |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param array $routes |
||
| 24 | */ |
||
| 25 | 1 | public function setRoutes($routes) |
|
| 31 | |||
| 32 | /** |
||
| 33 | * @param Route $route |
||
| 34 | */ |
||
| 35 | 1 | public function prependRoute($route) |
|
| 41 | |||
| 42 | /** |
||
| 43 | * @param $route |
||
| 44 | * @return bool |
||
| 45 | */ |
||
| 46 | public function has($route) |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param $route |
||
| 55 | * @return Route|\Symfony\Component\Routing\Route|null |
||
| 56 | */ |
||
| 57 | 5 | public function get($route) |
|
| 62 | |||
| 63 | |||
| 64 | /** |
||
| 65 | * @param Route $route |
||
| 66 | * @param null $name |
||
| 67 | * @return |
||
| 68 | */ |
||
| 69 | 12 | public function addRoute($route, $name = null) |
|
| 78 | } |
||
| 79 |
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.