Completed
Push — develop ( 5bf394...6bbee1 )
by Tom
06:47
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
12
use ArrayIterator;
13
use EmptyIterator;
14
use IteratorIterator;
15
use Magento\Framework\Module\ModuleListInterface;
16
17
/**
18
 * Class ModuleListIterator
19
 *
20
 * @package N98\Magento\Api
21
 */
22
class ModuleListIterator extends IteratorIterator
23
{
24
    public function __construct(ModuleListInterface $moduleList)
25
    {
26
        parent::__construct(new ArrayIterator($moduleList->getAll()));
27
    }
28
29
    /**
30
     * @return Module
31
     */
32
    public function current()
33
    {
34
        $current = parent::current();
35
36
        $module = new Module($current['name'], $current['setup_version']);
37
38
        return $module;
39
    }
40
}
41