| Conditions | 5 |
| Paths | 5 |
| Total Lines | 24 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 51 | 8 | public function create(string $extension, string $content): ContentInterface |
|
| 52 | { |
||
| 53 | switch ($extension) { |
||
| 54 | /** |
||
| 55 | * Create JSON Content |
||
| 56 | */ |
||
| 57 | 8 | case static::EXT_JSON: |
|
| 58 | 1 | return new JsonContent($content); |
|
| 59 | break; |
||
|
|
|||
| 60 | /** |
||
| 61 | * Create YAML Content |
||
| 62 | */ |
||
| 63 | 7 | case static::EXT_YAML: |
|
| 64 | 7 | case static::EXT_YML: |
|
| 65 | 1 | return new YamlContent($content); |
|
| 66 | break; |
||
| 67 | /** |
||
| 68 | * Default TXT Content |
||
| 69 | */ |
||
| 70 | 6 | case static::EXT_TXT: |
|
| 71 | default: |
||
| 72 | 6 | return new Content($content); |
|
| 73 | } |
||
| 74 | } |
||
| 75 | } |
||
| 76 |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.