Completed
Push — master ( 6d20cc...f05bcc )
by T
10:20
created

InputMerger::getKeysOfNullValues()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace PHPSemVerChecker\Console;
4
5
use PHPSemVerChecker\Configuration\Configuration;
6
use Symfony\Component\Console\Input\InputInterface;
7
8
/**
9
 * Merges CLI input with existing configuration values.
10
 *
11
 * This is to ensure that CLI input has priority and is prepared for validation
12
 * by symfony/console commands.
13
 */
14
class InputMerger
15
{
16
	/**
17
	 * @param \Symfony\Component\Console\Input\InputInterface $input
18
	 * @param \PHPSemVerChecker\Configuration\Configuration $config
19
	 */
20 1
	public function merge(InputInterface $input, Configuration $config)
21
	{
22 1
		foreach ($input->getArguments() as $argument => $value) {
23 1
			if ($input->hasArgumentSet($argument)) {
0 ignored issues
show
Bug introduced by
The method hasArgumentSet() does not exist on Symfony\Component\Console\Input\InputInterface. Did you maybe mean hasArgument()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
24 1
				$config->set($argument, $value);
25 1
			} else {
26 1
				$input->setArgument($argument, $config->get($argument));
27
			}
28 1
		}
29
30 1
		foreach ($input->getOptions() as $option => $value) {
31 1
			if ($input->hasOptionSet($option)) {
0 ignored issues
show
Bug introduced by
The method hasOptionSet() does not exist on Symfony\Component\Console\Input\InputInterface. Did you maybe mean hasOption()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
32 1
				$config->set($option, $value);
33 1
			} else {
34 1
				$input->setOption($option, $config->get($option));
35
			}
36 1
		}
37 1
	}
38
}
39