1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Cli\Command\InputArgumentKeys |
5
|
|
|
* |
6
|
|
|
* PHP version 7 |
7
|
|
|
* |
8
|
|
|
* @author Tim Wagner <[email protected]> |
9
|
|
|
* @copyright 2020 TechDivision GmbH <[email protected]> |
10
|
|
|
* @license https://opensource.org/licenses/MIT |
11
|
|
|
* @link https://github.com/techdivision/import-cli |
12
|
|
|
* @link http://www.techdivision.com |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace TechDivision\Import\Cli\Command; |
16
|
|
|
|
17
|
|
|
use TechDivision\Import\Utils\InputArgumentKeysInterface; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Utility class containing the available input argument keys. |
21
|
|
|
* |
22
|
|
|
* @author Tim Wagner <[email protected]> |
23
|
|
|
* @copyright 2020 TechDivision GmbH <[email protected]> |
24
|
|
|
* @license https://opensource.org/licenses/MIT |
25
|
|
|
* @link https://github.com/techdivision/import-cli |
26
|
|
|
* @link http://www.techdivision.com |
27
|
|
|
*/ |
28
|
|
|
class InputArgumentKeys extends \ArrayObject implements InputArgumentKeysInterface |
29
|
|
|
{ |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Construct a new input option instance. |
33
|
|
|
* |
34
|
|
|
* @param array $inputArgumentKeys 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 $inputArgumentKeys = array()) |
38
|
|
|
{ |
39
|
|
|
|
40
|
|
|
// merge the input argument keys with the passed ones |
41
|
|
|
$mergedInputArgumentKeys = array_merge( |
42
|
|
|
array( |
43
|
|
|
InputArgumentKeysInterface::SHORTCUT, |
44
|
|
|
InputArgumentKeysInterface::OPERATION_NAMES, |
45
|
|
|
InputArgumentKeysInterface::ENTITY_TYPE_CODE, |
46
|
|
|
InputArgumentKeysInterface::COLUMN, |
47
|
|
|
InputArgumentKeysInterface::VALUES, |
48
|
|
|
), |
49
|
|
|
$inputArgumentKeys |
50
|
|
|
); |
51
|
|
|
|
52
|
|
|
// initialize the parent class with the merged input argument keys |
53
|
|
|
parent::__construct($mergedInputArgumentKeys); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Query whether or not the passed input argument is valid. |
58
|
|
|
* |
59
|
|
|
* @param string $inputArgument The input argument to query for |
60
|
|
|
* |
61
|
|
|
* @return boolean TRUE if the input argument is valid, else FALSE |
62
|
|
|
*/ |
63
|
|
|
public function isInputArgument($inputArgument) |
64
|
|
|
{ |
65
|
|
|
return in_array($inputArgument, (array) $this); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|