| Conditions | 4 |
| Paths | 5 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 50 | public function onControllerSetup(Event $event) |
||
| 51 | { |
||
| 52 | /** @var AppController $controller */ |
||
| 53 | $controller = $event->getSubject(); |
||
| 54 | $isAdmin = ($controller->request->getParam('prefix') === 'admin'); |
||
| 55 | |||
| 56 | $plugins = Plugin::loaded(); |
||
| 57 | foreach ($plugins as $plugin) { |
||
|
|
|||
| 58 | $path = Plugin::path($plugin); |
||
| 59 | $menuFile = ($isAdmin) ? 'admin_menu' : 'menu'; |
||
| 60 | $navConf = $path . 'config/' . $menuFile . '.php'; |
||
| 61 | |||
| 62 | if (FS::isFile($navConf)) { |
||
| 63 | /** @noinspection PhpIncludeInspection */ |
||
| 64 | require_once $navConf; |
||
| 65 | } |
||
| 66 | } |
||
| 67 | } |
||
| 68 | } |
||
| 69 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.