Task_DB_Recreate   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A _execute() 0 17 3
1
<?php defined('SYSPATH') OR die('No direct script access.');
2
3
/**
4
 * Drop all the tables and rerun all the migrations.
5
 * Will ask for confirmation before proceeding.
6
 *
7
 * options:
8
 *  - force: use this flag to skip confirmation
9
 */
10
class Task_DB_Recreate extends Minion_Task {
11
12
	protected $_options = array(
13
		'force' => FALSE,
14
	);
15
16
	protected function _execute(array $options)
17
	{
18
		if ($options['force'] === NULL OR 'yes' === Minion_CLI::read('This will destroy all data in the current database. Are you sure? [yes/NO]'))
19
		{
20
			Minion_CLI::write('Dropping Tables', 'green');
0 ignored issues
show
Unused Code introduced by
The call to Minion_CLI::write() has too many arguments starting with 'green'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
21
22
			$migrations = new Migrations(array('log' => 'Minion_CLI::write'));
23
			$migrations->clear_all();
24
			$options['task'] = 'db:migrate';
25
26
			Minion_Task::factory($options)->execute();
27
		}
28
		else
29
		{
30
			Minion_CLI::write(Minion_CLI::color('Nothing done', 'brown'));
31
		}
32
	}
33
}
34