SeedResetCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

2 Methods

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