Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | public function make(string $code, array $additional = []): array |
||
40 | { |
||
41 | $code = str_replace('.', '/', $code); |
||
42 | |||
43 | $path = $this->folder . '/' . $code . '.php'; |
||
44 | |||
45 | if (! FileManager::exists($path)) { |
||
46 | throw new \InvalidArgumentException('No such fixture: ' . $path); |
||
47 | } |
||
48 | |||
49 | $fixture = FileManager::include($path); |
||
50 | |||
51 | if (! is_array($fixture)) { |
||
52 | throw new \InvalidArgumentException('Fixture must be a valid array'); |
||
53 | } |
||
54 | |||
55 | return array_merge($fixture, $additional); |
||
56 | } |
||
95 |