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