Passed
Push — master ( f13f78...5c1b24 )
by Ismayil
04:22
created

UnseedCommand::command()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 0
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Elgg\Cli;
4
5
/**
6
 * elgg-cli unseed
7
 */
8
class UnseedCommand extends Command {
9
10
	/**
11
	 * {@inheritdoc}
12
	 */
13
	protected function configure() {
14
		$this->setName('unseed')
15
			->setDescription('Removes seeded fake entities from the database');
16
	}
17
18
	/**
19
	 * {@inheritdoc}
20
	 */
21
	protected function command() {
22
23
		if (!class_exists('\Faker\Generator')) {
24
			elgg_log('This is a developer tool currently intended for testing purposes only. Please refrain from using it.', 'ERROR');
25
			return 1;
26
		}
27
28
		set_time_limit(0);
29
30
		_elgg_services()->setValue('mailer', new \Zend\Mail\Transport\InMemory());
31
32
		_elgg_services()->seeder->unseed();
33
	}
34
35
}