| 1 | <?php namespace Propaganistas\LaravelIntl\Base; |
||
| 3 | trait LocaleCallback |
||
| 4 | { |
||
| 5 | /** |
||
| 6 | * Temporarily use another locale for the given callback. |
||
| 7 | * |
||
| 8 | * @param string $locale |
||
| 9 | * @param callable $callback |
||
| 10 | * @param string $fallbackLocale |
||
| 11 | * @return mixed |
||
| 12 | */ |
||
| 13 | 15 | public function forLocale($locale, callable $callback, $fallbackLocale = '') |
|
| 28 | } |
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.