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

ListDumpsCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 4
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 2
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