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

InputArgumentKeys::isInputArgument()   A

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
rs 10
ccs 0
cts 3
cp 0
crap 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Cli\Command\InputArgumentKeys
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 2020 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
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Cli\Command;
22
23
use TechDivision\Import\Utils\InputArgumentKeysInterface;
24
25
/**
26
 * Utility class containing the available input argument keys.
27
 *
28
 * @author    Tim Wagner <[email protected]>
29
 * @copyright 2020 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
32
 * @link      http://www.techdivision.com
33
 */
34
class InputArgumentKeys extends \ArrayObject implements InputArgumentKeysInterface
35
{
36
37
    /**
38
     * Construct a new input option instance.
39
     *
40
     * @param array $inputArgumentKeys 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 $inputArgumentKeys = array())
44
    {
45
46
        // merge the input argument keys with the passed ones
47
        $mergedInputArgumentKeys = array_merge(
48
            array(
49
                InputArgumentKeysInterface::SHORTCUT,
50
                InputArgumentKeysInterface::OPERATION_NAMES,
51
                InputArgumentKeysInterface::ENTITY_TYPE_CODE,
52
                InputArgumentKeysInterface::COLUMN,
53
                InputArgumentKeysInterface::VALUES,
54
            ),
55
            $inputArgumentKeys
56
        );
57
58
        // initialize the parent class with the merged input argument keys
59
        parent::__construct($mergedInputArgumentKeys);
60
    }
61
62
    /**
63
     * Query whether or not the passed input argument is valid.
64
     *
65
     * @param string $inputArgument The input argument to query for
66
     *
67
     * @return boolean TRUE if the input argument is valid, else FALSE
68
     */
69
    public function isInputArgument($inputArgument)
70
    {
71
        return in_array($inputArgument, (array) $this);
72
    }
73
}
74