DynamicModelSeederTask   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSeedingMode() 0 3 1
A getModelName() 0 5 1
A fieldFormatters() 0 3 1
1
<?php
2
3
App::uses('SeederTaskBase', 'FakeSeeder.Console');
4
5
/**
6
 * A Dynamic Model Seeder Task
7
 *
8
 * Gets called when there is no seeder shell task named like given one.
9
 * Since there are no field formatters set, it needs to guess them.
10
 * Most often, this only works for very simple models that have no validation rules.
11
 * So don't expect any great magic done here!
12
 */
13
class DynamicModelSeederTask extends SeederTaskBase {
14
15
	/**
16
	 * Force the seeder to guess the field formaters
17
	 *
18
	 * @return mixed The the 'auto' seeding mode.
19
	 */
20
	public function getSeedingMode() {
21
		return 'auto';
22
	}
23
24
	/**
25
	 * Take the model name from the argument list
26
	 *
27
	 * @return string The model name, taken from the argument list.
28
	 */
29
	public function getModelName() {
30
		$modelName = $this->args[0];
31
32
		return $modelName;
33
	}
34
35
	/**
36
	 * Set/get the field formatters
37
	 *
38
	 * Just return the field formatters.
39
	 *
40
	 * {@inheritDoc}
41
	 */
42
	public function fieldFormatters() {
43
		return $this->_fieldFormatters;
44
	}
45
46
}
47