Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
42 | private function loadConfigs($directory) |
||
43 | { |
||
44 | if (File::isDirectory($directory)) { |
||
45 | |||
46 | $files = File::allFiles($directory); |
||
47 | |||
48 | foreach ($files as $file) { |
||
49 | // build the key from the file name (just remove the .php extension from the file name) |
||
50 | $fileNameOnly = str_replace('.php', '', $file->getFilename()); |
||
51 | |||
52 | // merge the config file |
||
53 | $this->mergeConfigFrom($file->getPathname(), $fileNameOnly); |
||
|
|||
54 | } |
||
55 | } |
||
56 | } |
||
57 | } |
||
58 |
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
Idable
provides a methodequalsId
that 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.