Conditions | 6 |
Paths | 10 |
Total Lines | 23 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 11.4603 |
Changes | 0 |
1 | <?php |
||
21 | 2 | public function create($name, array $options = array()) |
|
22 | { |
||
23 | 2 | $client = null; |
|
24 | |||
25 | switch ($name) { |
||
26 | 2 | case 'rsync': |
|
27 | 2 | $client = new RsyncClient($options); |
|
28 | 2 | break; |
|
29 | case 'mock': |
||
30 | case 'test': |
||
31 | $client = new MockClient(); |
||
32 | break; |
||
33 | case 'copy': |
||
34 | $client = new CopyClient(); |
||
35 | break; |
||
36 | } |
||
37 | |||
38 | 2 | if (! $client) { |
|
39 | throw new \InvalidArgumentException(sprintf('Client `%s` does not exists.', $name)); |
||
40 | } |
||
41 | |||
42 | 2 | return $client; |
|
43 | } |
||
44 | } |
||
45 |