Completed
Push — develop ( 5bf394...6bbee1 )
by Tom
06:47
created

ModuleListIterator::current()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
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