ReleaseSetup::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 6
ccs 0
cts 6
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Deploid\Command;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Deploid\Payload;
10
11
/**
12
 * @method \Deploid\Application getApplication() return application object
13
 */
14
class ReleaseSetup extends Command {
15
16
	protected function configure() {
17
		$this->setName('release:setup');
18
		$this->setDescription('Setup the current release');
19
		$this->setHelp('This command setup the current release');
20
		$this->addArgument('release', InputArgument::REQUIRED, 'release name');
21
		$this->addArgument('path', InputArgument::OPTIONAL, 'path to target directory', getcwd());
22
	}
23
24
	protected function execute(InputInterface $input, OutputInterface $output) {
25
		$payload = $this->getApplication()->deploidStructureValidate($input->getArgument('path'));
0 ignored issues
show
Bug introduced by
It seems like $input->getArgument('path') can also be of type string[]; however, parameter $path of Deploid\Application::deploidStructureValidate() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
		$payload = $this->getApplication()->deploidStructureValidate(/** @scrutinizer ignore-type */ $input->getArgument('path'));
Loading history...
26
		if ($payload->getType() == Payload::STRUCTURE_VALIDATE_FAIL) {
27
			$output->writeln($payload->getMessage());
28
			return $payload->getCode();
29
		}
30
31
		$payload = $this->getApplication()->deploidReleaseSetup($input->getArgument('release'), $input->getArgument('path'));
0 ignored issues
show
Bug introduced by
It seems like $input->getArgument('release') can also be of type string[]; however, parameter $release of Deploid\Application::deploidReleaseSetup() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

31
		$payload = $this->getApplication()->deploidReleaseSetup(/** @scrutinizer ignore-type */ $input->getArgument('release'), $input->getArgument('path'));
Loading history...
Bug introduced by
It seems like $input->getArgument('path') can also be of type string[]; however, parameter $path of Deploid\Application::deploidReleaseSetup() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

31
		$payload = $this->getApplication()->deploidReleaseSetup($input->getArgument('release'), /** @scrutinizer ignore-type */ $input->getArgument('path'));
Loading history...
32
		$output->writeln($payload->getMessage());
33
		return $payload->getCode();
34
	}
35
36
}