Total Complexity | 3 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 57.14% |
Changes | 0 |
1 | <?php |
||
22 | class ArrayFixture extends Fixture implements \IteratorAggregate, \ArrayAccess, \Countable |
||
23 | { |
||
24 | use ArrayAccessTrait; |
||
25 | use FileFixtureTrait; |
||
26 | |||
27 | /** |
||
28 | * @var array the data rows. Each array element represents one row of data (column name => column value). |
||
29 | */ |
||
30 | public $data = []; |
||
31 | |||
32 | |||
33 | /** |
||
34 | * Loads the fixture. |
||
35 | * |
||
36 | * The default implementation simply stores the data returned by [[getData()]] in [[data]]. |
||
37 | * You should usually override this method by putting the data into the underlying database. |
||
38 | */ |
||
39 | 3 | public function load() |
|
40 | { |
||
41 | 3 | $this->data = $this->getData(); |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * Returns the fixture data. |
||
46 | * |
||
47 | * The default implementation will try to return the fixture data by including the external file specified by [[dataFile]]. |
||
48 | * The file should return the data array that will be stored in [[data]] after inserting into the database. |
||
49 | * |
||
50 | * @return array the data to be put into the database |
||
51 | * @throws InvalidConfigException if the specified data file does not exist. |
||
52 | */ |
||
53 | 3 | protected function getData() |
|
54 | { |
||
55 | 3 | return $this->loadData($this->dataFile); |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function unload() |
||
65 | } |
||
66 | } |
||
67 |