InputOptionKeys::isInputOption()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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