Passed
Push — master ( 4a6f80...f69c31 )
by Fabian
18:04 queued 14:54
created

ModuleList::getHyvaGridData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 2
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Firegento\DevDashboard\ViewModel\Widget;
4
5
use Hyva\Admin\Api\HyvaGridArrayProviderInterface;
0 ignored issues
show
Bug introduced by
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) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
Coding Style introduced by
Expected 1 space after USE keyword; found 0
Loading history...
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
        return $this->getModuleList();
34
    }
35
}
36