Completed
Push — master ( d4177d...478de1 )
by Marcus
04:46
created

InputOptionKeys   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 33
c 2
b 0
f 0
dl 0
loc 60
rs 10
ccs 0
cts 39
cp 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 39 1
A isInputOption() 0 3 1
1
<?php
2
3
/**
4
 * TechDivision\Import\Cli\Command\InputOptionKeys
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 2016 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-cli-simple
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Cli\Command;
22
23
use TechDivision\Import\Utils\InputOptionKeysInterface;
24
25
/**
26
 * Utility class containing the available input options.
27
 *
28
 * @author    Tim Wagner <[email protected]>
29
 * @copyright 2016 TechDivision GmbH <[email protected]>
30
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
31
 * @link      https://github.com/techdivision/import-cli-simple
32
 * @link      http://www.techdivision.com
33
 */
34
class InputOptionKeys extends \ArrayObject implements InputOptionKeysInterface
35
{
36
37
    /**
38
     * Construct a new input option instance.
39
     *
40
     * @param array $inputOptionKeys The array with the additional input option names
41
     * @link http://www.php.net/manual/en/arrayobject.construct.php
42
     */
43
    public function __construct(array $inputOptionKeys = array())
44
    {
45
46
        // merge the input options with the passed ones
47
        $mergedInputOptionKeys = array_merge(
48
            array(
49
                InputOptionKeysInterface::SERIAL,
50
                InputOptionKeysInterface::SYSTEM_NAME,
51
                InputOptionKeysInterface::CONFIGURATION,
52
                InputOptionKeysInterface::INSTALLATION_DIR,
53
                InputOptionKeysInterface::SOURCE_DIR,
54
                InputOptionKeysInterface::TARGET_DIR,
55
                InputOptionKeysInterface::ARCHIVE_DIR,
56
                InputOptionKeysInterface::ARCHIVE_ARTEFACTS,
57
                InputOptionKeysInterface::CLEAR_ARTEFACTS,
58
                InputOptionKeysInterface::MAGENTO_EDITION,
59
                InputOptionKeysInterface::MAGENTO_VERSION,
60
                InputOptionKeysInterface::USE_DB_ID,
61
                InputOptionKeysInterface::DB_PDO_DSN,
62
                InputOptionKeysInterface::DB_USERNAME,
63
                InputOptionKeysInterface::DB_PASSWORD,
64
                InputOptionKeysInterface::DB_TABLE_PREFIX,
65
                InputOptionKeysInterface::DEBUG_MODE,
66
                InputOptionKeysInterface::LOG_LEVEL,
67
                InputOptionKeysInterface::PID_FILENAME,
68
                InputOptionKeysInterface::DEST,
69
                InputOptionKeysInterface::SINGLE_TRANSACTION,
70
                InputOptionKeysInterface::PARAMS,
71
                InputOptionKeysInterface::PARAMS_FILE,
72
                InputOptionKeysInterface::CACHE_ENABLED,
73
                InputOptionKeysInterface::MOVE_FILES_PREFIX,
74
                InputOptionKeysInterface::CUSTOM_CONFIGURATION_DIR,
75
                InputOptionKeysInterface::RENDER_VALIDATION_ISSUES
76
            ),
77
            $inputOptionKeys
78
        );
79
80
        // initialize the parent class with the merged input options
81
        parent::__construct($mergedInputOptionKeys);
82
    }
83
84
    /**
85
     * Query whether or not the passed input option is valid.
86
     *
87
     * @param string $inputOption The input option to query for
88
     *
89
     * @return boolean TRUE if the input option is valid, else FALSE
90
     */
91
    public function isInputOption($inputOption)
92
    {
93
        return in_array($inputOption, (array) $this);
94
    }
95
}
96