Conditions | 7 |
Paths | 7 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
42 | 23 | protected function loadData($file, $throwException = true) |
|
43 | { |
||
44 | 23 | if ($file === null || $file === false) { |
|
45 | 1 | return []; |
|
46 | } |
||
47 | |||
48 | 22 | if (basename($file) === $file && $this->dataDirectory !== null) { |
|
49 | 4 | $file = $this->dataDirectory . '/' . $file; |
|
50 | } |
||
51 | |||
52 | 22 | $file = Yii::getAlias($file); |
|
53 | 22 | if (is_file($file)) { |
|
54 | 17 | return require $file; |
|
55 | } |
||
56 | |||
57 | 5 | if ($throwException) { |
|
58 | 1 | throw new InvalidConfigException("Fixture data file does not exist: {$file}"); |
|
59 | } |
||
60 | |||
61 | 4 | return []; |
|
62 | } |
||
63 | |||
65 |