Issues (14)

src/ViewModel/Widget/ModuleList.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Firegento\DevDashboard\ViewModel\Widget;
4
5
use Hyva\Admin\Api\HyvaGridArrayProviderInterface;
0 ignored issues
show
The type Hyva\Admin\Api\HyvaGridArrayProviderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Magento\Framework\View\Element\Block\ArgumentInterface;
7
use Magento\Framework\Module\ModuleListInterface;
8
9
class ModuleList implements ArgumentInterface, HyvaGridArrayProviderInterface
10
{
11
    private $moduleListInterface;
12
13
    public function __construct(ModuleListInterface $moduleListInterface)
14
    {
15
        $this->moduleListInterface = $moduleListInterface;
16
    }
17
18
    public function getModuleList()
19
    {
20
        $n = 1;
21
        return array_map(function ($module) use (&$n) {
22
            unset($module['sequence']);
23
            $module['type'] = (strpos($module['name'], 'Magento_') !== false) ?
24
                'Core' : 'External';
25
            return ['load order' => $n++] + $module;
26
        }, $this->moduleListInterface->getAll());
27
    }
28
29
    /**
30
     * @return array[]
31
     */
32
    public function getHyvaGridData(): array
33
    {
34
        return $this->getModuleList();
35
    }
36
}
37