Completed
Push — master ( 665429...116aa7 )
by Adam
07:10
created

UninstallCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 7
loc 7
ccs 0
cts 4
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * UninstallCommand.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        http://www.ipublikuj.eu
7
 * @author         Adam Kadlec http://www.ipublikuj.eu
8
 * @package        iPublikuj:Packages!
9
 * @subpackage     Commands
10
 * @since          2.0.0
11
 *
12
 * @date           19.07.16
13
 */
14
15
declare(strict_types = 1);
16
17
namespace IPub\Packages\Commands;
18
19
use Symfony\Component\Console\Input;
20
use Symfony\Component\Console\Output;
21
22
use IPub;
23
use IPub\Packages;
24
use IPub\Packages\DependencyResolver;
25
use IPub\Packages\Exceptions;
26
27
/**
28
 * Package install command
29
 *
30
 * @package        iPublikuj:Packages!
31
 * @subpackage     Commands
32
 *
33
 * @author         Adam Kadlec <[email protected]>
34
 */
35 1 View Code Duplication
final class UninstallCommand extends Command
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
36
{
37
	/**
38
	 * @return void
39
	 */
40
	protected function configure()
41
	{
42
		$this
43
			->setName('ipub:packages:uninstall')
44
			->addArgument('package', Input\InputArgument::REQUIRED, 'Package name')
45
			->setDescription('Uninstall package.');
46
	}
47
48
	/**
49
	 * @param Input\InputInterface $input
50
	 * @param Output\OutputInterface $output
51
	 * 
52
	 * @return void
53
	 */
54
	protected function execute(Input\InputInterface $input, Output\OutputInterface $output)
55
	{
56
		try {
57
			$this->packageManager->uninstall($input->getArgument('package'));
58
59
			$output->writeln(sprintf('Package \'%s\' has been installed.', $input->getArgument('package')));
60
61
		} catch (Exceptions\InvalidArgumentException $e) {
62
			$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
63
		}
64
	}
65
}
66