Completed
Push — develop ( 38ffc4...0b6176 )
by Tom
05:53
created

ModuleListIterator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A current() 0 8 1
1
<?php
2
/*
3
 * @author Tom Klingenberg <[email protected]>
4
 * @copyright Copyright (c) 2016 netz98 new media GmbH (http://www.netz98.de)
5
 *
6
 * @see PROJECT_LICENSE.txt
7
 */
8
9
namespace N98\Magento\Api;
10
11
use ArrayIterator;
12
use IteratorIterator;
13
use Magento\Framework\Module\ModuleListInterface;
14
15
/**
16
 * Class ModuleListIterator
17
 *
18
 * @package N98\Magento\Api
19
 */
20
class ModuleListIterator extends IteratorIterator
21
{
22
    public function __construct(ModuleListInterface $moduleList)
23
    {
24
        parent::__construct(new ArrayIterator($moduleList->getAll()));
25
    }
26
27
    /**
28
     * @return Module
29
     */
30
    public function current()
31
    {
32
        $current = parent::current();
33
34
        $module = new Module($current['name'], $current['setup_version']);
35
36
        return $module;
37
    }
38
}
39