Conditions | 8 |
Paths | 8 |
Total Lines | 24 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 8 |
Changes | 0 |
1 | <?php |
||
20 | 12 | public function getDroplet(Array $dropletInfo) |
|
21 | { |
||
22 | 12 | if (!isset($dropletInfo['image']['distribution'])) { |
|
23 | 2 | throw new InvalidArgumentException('Image information not found in droplet info'); |
|
24 | } |
||
25 | |||
26 | 10 | $image = $dropletInfo['image']['distribution']; |
|
27 | |||
28 | 10 | switch (strtolower($image)) { |
|
29 | 10 | case 'ubuntu': |
|
30 | 4 | return new Ubuntu($dropletInfo); |
|
31 | 6 | case 'fedora': |
|
32 | 1 | return new Fedora($dropletInfo); |
|
33 | 5 | case 'debian': |
|
34 | 1 | return new Debian($dropletInfo); |
|
35 | 4 | case 'centos': |
|
36 | 1 | return new CentOS($dropletInfo); |
|
37 | 3 | case 'coreos': |
|
38 | 1 | return new CoreOS($dropletInfo); |
|
39 | 2 | case 'freebsd': |
|
40 | 1 | return new FreeBSD($dropletInfo); |
|
41 | } |
||
42 | |||
43 | 1 | throw new RuntimeException('There is no droplet matching the image provided in the droplet info'); |
|
44 | } |
||
46 |