| 1 | <?php namespace Modules\Core\Traits; |
||
| 3 | trait CanPublishConfiguration |
||
| 4 | { |
||
| 5 | /** |
||
| 6 | * Publish the given configuration file name (without extension) and the given module |
||
| 7 | * @param string $module |
||
| 8 | * @param string $fileName |
||
| 9 | */ |
||
| 10 | public function publishConfig($module, $fileName) |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Get path of the give file name in the given module |
||
| 20 | * @param string $module |
||
| 21 | * @param string $file |
||
| 22 | * @return string |
||
| 23 | */ |
||
| 24 | private function getModuleConfigFilePath($module, $file) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param $module |
||
| 31 | * @return string |
||
| 32 | */ |
||
| 33 | private function getModulePath($module) |
||
| 37 | } |
||
| 38 |
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.