Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.0416 |
Changes | 0 |
1 | <?php |
||
7 | 7 | public static function buildFromString(string $string): Type |
|
8 | { |
||
9 | 7 | if (preg_match('/^git$/i', $string)) { |
|
10 | 6 | return new Git; |
|
11 | } |
||
12 | |||
13 | 2 | if (preg_match('/^tar$/i', $string)) { |
|
14 | 2 | return new Tar; |
|
15 | } |
||
16 | |||
17 | throw new \RuntimeException(sprintf('Impossible to create a type from string "%s"', $string)); |
||
18 | } |
||
20 |