Completed
Push — 8.x ( 824af6 )
by Tim
09:11
created

EditionNames   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 36
c 0
b 0
f 0
ccs 0
cts 15
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A isEditionName() 0 4 1
1
<?php
2
3
/**
4
 * TechDivision\Import\Utils\EditionNames
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2019 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/techdivision/import
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Utils;
22
23
/**
24
 * Utility class containing the supported Magento edition names.
25
 *
26
 * @author    Tim Wagner <[email protected]>
27
 * @copyright 2019 TechDivision GmbH <[email protected]>
28
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
29
 * @link      https://github.com/techdivision/import
30
 * @link      http://www.techdivision.com
31
 */
32
class EditionNames extends \ArrayObject implements EditionNamesInterface
33
{
34
    /**
35
     * Construct a new edition names instance.
36
     *
37
     * @param array $editionNames The array with the additional edition names
38
     * @link http://www.php.net/manual/en/arrayobject.construct.php
39
     */
40
    public function __construct(array $editionNames = array())
41
    {
42
43
        // merge the edition names with the passed ones
44
        $mergedEditionNames = array_merge(
45
            array(
46
                EditionNamesInterface::CE,
47
                EditionNamesInterface::EE
48
            ),
49
            $editionNames
50
        );
51
52
        // initialize the parent class with the merged edition names
53
        parent::__construct($mergedEditionNames);
54
    }
55
56
    /**
57
     * Query whether or not the passed edition name is valid.
58
     *
59
     * @param string $editionName The edition name to query for
60
     *
61
     * @return boolean TRUE if the edition name is valid, else FALSE
62
     */
63
    public function isEditionName($editionName)
64
    {
65
        return in_array($editionName, (array) $this);
66
    }
67
}
68