Completed
Push — master ( 357eb6...5eff20 )
by dima
02:34
created

SeedResetCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 5
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 10 1
A execute() 0 14 3
1
<?php
2
3
namespace Frameworkless\Console\Commands;
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\InputDefinition;
9
use Symfony\Component\Console\Input\InputOption;
10
use Symfony\Component\Console\Input\InputArgument;
11
12
/**
13
 * Description of HelloWorldCommand
14
 *
15
 * @author Dmitriy
16
 */
17
class SeedResetCommand extends Command
18
{
19
20
	protected function configure()
21
	{
22
		$this->setName('seed:reset')
23
				->setDescription('Reset all seeds data')
24
				->setDefinition(
25
						new InputDefinition(array(
26
					new InputOption('class', 'c', InputOption::VALUE_REQUIRED)
27
						))
28
		);
29
	}
30
31
	protected function execute(InputInterface $input, OutputInterface $output)
32
	{
33
	
34
		if (!$class = $input->getOption('class')) {
35
			$output->writeln("Class Model not set");
36
			return;
37
		}
38
39
		if($class::reset()){
40
			$output->writeln(sprintf("Seed %s reset success!", $class));
41
		}
42
		else
43
			$output->writeln("Command seed:reset fail to execute!");
44
	}
45
}
46