Completed
Push — master ( 4dc03d...bf54d1 )
by Gregory
22:33
created

ListDumpsCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 33
ccs 0
cts 14
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 10 1
A execute() 0 6 1
1
<?php
2
namespace Tivnet\WPDB\Command;
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\InputArgument;
8
use Symfony\Component\Console\Input\InputOption;
9
use Tivnet\WPDB\Config;
10
11
/**
12
 * Class ListDumpsCommand
13
 * @package Tivnet\WPDB\Command
14
 */
15
class ListDumpsCommand extends Command {
16
17
	/**
18
	 * Configuration
19
	 *
20
	 * @return void
21
	 */
22
	protected function configure() {
23
		$this->setName( 'list-dumps' )
24
		     ->setDescription( 'List dump files' )
25
		     ->setDefinition( array(
26
			     new InputOption( 'flag', 'f', InputOption::VALUE_NONE, 'Raise a flag' ),
27
			     new InputArgument( 'activities', InputArgument::IS_ARRAY, 'Space-separated activities to perform', null ),
28
		     ) )
29
		     ->setHelp( /** @lang text */
30
			     'The <info>list-dumps</info> shows the dump files in the `data` folder' );
31
	}
32
33
	/**
34
	 * Executes the command
35
	 *
36
	 * @param InputInterface  $input
37
	 * @param OutputInterface $output
38
	 *
39
	 * @return null|int
40
	 */
41
	protected function execute( InputInterface $input, OutputInterface $output ) {
42
43
		system( 'find ' . Config::$dir_dump . ' -name "*.' . Config::$dump_ext . '*" -exec ' . Config::$cmd_ls . ' {} ;' );
44
45
		return null;
46
	}
47
}
48